From f2d23ea85da0d02e7588b8632ad23368f00a97e7 Mon Sep 17 00:00:00 2001 From: Steinar Gunderson Date: Sun, 26 Sep 2010 02:24:28 +0200 Subject: [PATCH] Fix the output pts; the code for doing so is smaller than the comment. --- modules/codec/lpcm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c index 908fb934fc..88eab2e85b 100644 --- a/modules/codec/lpcm.c +++ b/modules/codec/lpcm.c @@ -493,6 +493,7 @@ static block_t *EncodeFrames( encoder_t *p_enc, aout_buffer_t *p_aout_buf ) 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; @@ -538,11 +539,8 @@ static block_t *EncodeFrames( encoder_t *p_enc, aout_buffer_t *p_aout_buf ) 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 ) -- 2.39.2