Commit 6124f982 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

assert that audio date divider is non-nul, refs #2169

parent c8a6cbfe
...@@ -479,6 +479,7 @@ void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) ...@@ -479,6 +479,7 @@ void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo )
*****************************************************************************/ *****************************************************************************/
void aout_DateInit( audio_date_t * p_date, uint32_t i_divider ) void aout_DateInit( audio_date_t * p_date, uint32_t i_divider )
{ {
assert (i_divider);
p_date->date = 0; p_date->date = 0;
p_date->i_divider = i_divider; p_date->i_divider = i_divider;
p_date->i_remainder = 0; p_date->i_remainder = 0;
...@@ -515,7 +516,8 @@ mtime_t aout_DateGet( const audio_date_t * p_date ) ...@@ -515,7 +516,8 @@ mtime_t aout_DateGet( const audio_date_t * p_date )
*****************************************************************************/ *****************************************************************************/
mtime_t aout_DateIncrement( audio_date_t * p_date, uint32_t i_nb_samples ) mtime_t aout_DateIncrement( audio_date_t * p_date, uint32_t i_nb_samples )
{ {
mtime_t i_dividend = (mtime_t)i_nb_samples * 1000000; mtime_t i_dividend = INT64_C(1000000) * i_nb_samples;
assert (p_date->i_divider); /* uninitialized audio_data_t ? */
p_date->date += i_dividend / p_date->i_divider; p_date->date += i_dividend / p_date->i_divider;
p_date->i_remainder += (int)(i_dividend % p_date->i_divider); p_date->i_remainder += (int)(i_dividend % p_date->i_divider);
if ( p_date->i_remainder >= p_date->i_divider ) if ( p_date->i_remainder >= p_date->i_divider )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment