const int i_leftover_samples = ( p_sys->i_buffer_used + p_aout_buf->i_nb_samples ) %
p_sys->i_frame_samples;
const int i_frame_size = p_sys->i_frame_samples * p_sys->i_channels * 2 + LPCM_VOB_HEADER_LEN;
+ const int i_start_offset = -p_sys->i_buffer_used;
uint8_t i_freq_code = 0;
p_sys->i_buffer_used = 0;
i_bytes_consumed += i_consume_bytes;
- /*
- * The pts is strictly not correct if we have samples kept from
- * a previous buffer, but the frames are so small it should be OK.
- */
- p_block->i_dts = p_block->i_pts = p_aout_buf->i_pts + i * p_sys->i_frame_samples * CLOCK_FREQ / p_sys->i_rate;
+ p_block->i_dts = p_block->i_pts = p_aout_buf->i_pts +
+ (i * p_sys->i_frame_samples + i_start_offset) * CLOCK_FREQ / p_sys->i_rate;
p_block->i_length = p_sys->i_frame_samples * CLOCK_FREQ / p_sys->i_rate;
if( !p_first_block )