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

Jai Menon jmenon86 at gmail.com
Sat Jul 24 07:06:44 CEST 2010


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.

-- 
Jai Menon



More information about the vlc-devel mailing list