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

Jai Menon jmenon86 at gmail.com
Sun Jul 25 10:19:09 CEST 2010


On Sun, Jul 25, 2010 at 1:59 AM, Laurent Aimar <fenrir at elivagar.org> wrote:
> Hi,
>
> On Sun, Jul 25, 2010 at 01:28:19AM +0530, Jai Menon wrote:
>> 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.
>  I may have misunderstood  your patch, but you must call ES_OUT_SET_PCR
> before sending the first packets. Otherwise they will be rejected.

would you be okay with updating the pcr after receiving a few packets
instead? this way nothing is lost.

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


More information about the vlc-devel mailing list