X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fmpeg_audio.c;h=6815abf64eaedfb4355de9b2bc7c47e3b3ef0922;hb=23da1b167917e629d5a25d74aef4371a78d8afd9;hp=1541911eedbbd41798f993b01e8c3d7a16d1c4b8;hpb=38c08789982d6a7b27ca4d24ab6c97f2051f2ca0;p=vlc diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c index 1541911eed..6815abf64e 100644 --- a/modules/codec/mpeg_audio.c +++ b/modules/codec/mpeg_audio.c @@ -149,6 +149,7 @@ static int Open( vlc_object_t *p_this ) p_sys->i_state = STATE_NOSYNC; date_Set( &p_sys->end_date, 0 ); p_sys->bytestream = block_BytestreamInit(); + p_sys->i_pts = VLC_TS_INVALID; p_sys->b_discontinuity = false; /* Set output properties */ @@ -216,7 +217,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) return NULL; } - if( !date_Get( &p_sys->end_date ) && !(*pp_block)->i_pts ) + if( !date_Get( &p_sys->end_date ) && (*pp_block)->i_pts <= VLC_TS_INVALID ) { /* We've just started the stream, wait for the first PTS. */ msg_Dbg( p_dec, "waiting for PTS" ); @@ -254,7 +255,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) case STATE_SYNC: /* New frame, set the Presentation Time Stamp */ p_sys->i_pts = p_sys->bytestream.p_block->i_pts; - if( p_sys->i_pts != 0 && + if( p_sys->i_pts > VLC_TS_INVALID && p_sys->i_pts != date_Get( &p_sys->end_date ) ) { date_Set( &p_sys->end_date, p_sys->i_pts ); @@ -470,7 +471,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) /* Make sure we don't reuse the same pts twice */ if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts ) - p_sys->i_pts = p_sys->bytestream.p_block->i_pts = 0; + p_sys->i_pts = p_sys->bytestream.p_block->i_pts = VLC_TS_INVALID; /* So p_block doesn't get re-added several times */ *pp_block = block_BytestreamPop( &p_sys->bytestream ); @@ -546,7 +547,7 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec ) p_sys->b_discontinuity = false; /* Hack for libmad filter */ - p_buf->i_nb_bytes = p_sys->i_frame_size + MAD_BUFFER_GUARD; + p_buf->i_buffer = p_sys->i_frame_size + MAD_BUFFER_GUARD; return p_buf; }