[vlc-devel] [PATCH] AVFormat Demux : Reset PCR for streams initialized later on.

Jai Menon jmenon86 at gmail.com
Sat Jul 24 21:58:19 CEST 2010


On Sat, Jul 24, 2010 at 10:36 AM, Jai Menon <jmenon86 at gmail.com> wrote:
> On Sat, Jul 24, 2010 at 9:50 AM, Jai Menon <jmenon86 at gmail.com> wrote:
>> A situation where this is desirable is when the video stream is
>> initialized after the audio stream. In this case the PCR must be
>> reset based on the video stream packet timestamp to avoid dropping
>> frames.
>> ---
>>  modules/demux/avformat/demux.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
>> index a8042b8..86aeb5d 100644
>> --- a/modules/demux/avformat/demux.c
>> +++ b/modules/demux/avformat/demux.c
>> @@ -588,7 +588,8 @@ static int Demux( demux_t *p_demux )
>>  #endif
>>
>>     if( p_frame->i_dts > VLC_TS_INVALID  &&
>> -        ( pkt.stream_index == p_sys->i_pcr_tk || p_sys->i_pcr_tk < 0 ) )
>> +        ( pkt.stream_index == p_sys->i_pcr_tk || p_sys->i_pcr_tk < 0 ||
>> +          p_frame->i_dts < p_sys->i_pcr ) )
>>     {
>>         p_sys->i_pcr_tk = pkt.stream_index;
>>         p_sys->i_pcr = p_frame->i_dts;
>> --
>> 1.7.1.1
>
> I'm still considering if there's a better solution to this, so please
> disregard for now.

After thinking some more, I think maybe something like attached would
be worth considering. Essentially, the reference is set after we get
atleast a few video and audio packets.

btw, this fixes sync issues with some vfw avis i have and also dv in
mov samples (referenced in a trac issue i think).

-- 
Jai Menon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avformat-pcr.diff
Type: text/x-patch
Size: 2677 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100725/5ee123f1/attachment.bin>


More information about the vlc-devel mailing list