[vlc-devel] [PATCH] demux: avformat: do not take account of invalid streams for PCR updating

Zhao Zhili wantlamy at gmail.com
Fri Mar 24 09:18:36 CET 2017


I have a video with two data stream:
 Duration: 01:14:10.80, start: 0.000000, bitrate: 404 kb/s
    Stream #0:0: Audio: cook (cook / 0x6B6F6F63), 44100 Hz, stereo, fltp,
64 kb/s
    Stream #0:1: Video: rv40 (RV40 / 0x30345652), yuv420p, 608x256, 332
kb/s, 30 fps, 30 tbr, 1k tbn, 1k tbc
    Stream #0:2: Data: none, 0 kb/s
    Stream #0:3: Data: none, 0 kb/s
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3

Without this patch, VLC doesn't refresh position (or time) information at
the first few
seconds. The MainLoop in input.c sleep too long before run
MainLoopStatistics. I think
PCR updating should not take account of those invalid streams, but I'm not
sure.

On Wed, Mar 22, 2017 at 4:13 PM, Jean-Baptiste Kempf <jb at videolan.org>
wrote:

> ping for review
>
> On Mon, 20 Mar 2017, at 16:56, Zhao Zhili wrote:
> > ---
> >  modules/demux/avformat/demux.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/modules/demux/avformat/demux.c
> > b/modules/demux/avformat/demux.c
> > index 4824215..48ba7f8 100644
> > --- a/modules/demux/avformat/demux.c
> > +++ b/modules/demux/avformat/demux.c
> > @@ -834,17 +834,22 @@ static int Demux( demux_t *p_demux )
> >      msg_Dbg( p_demux, "tk[%d] dts=%"PRId64" pts=%"PRId64,
> >               pkt.stream_index, p_frame->i_dts, p_frame->i_pts );
> >  #endif
> > -    if( p_frame->i_dts > VLC_TS_INVALID )
> > +    if( p_frame->i_dts > VLC_TS_INVALID && p_sys->tk[pkt.stream_index]
> > != NULL )
> >          p_sys->tk_pcr[pkt.stream_index] = p_frame->i_dts;
> >
> >      int64_t i_ts_max = INT64_MIN;
> >      for( int i = 0; i < p_sys->i_tk; i++ )
> > -        i_ts_max = __MAX( i_ts_max, p_sys->tk_pcr[i] );
> > +    {
> > +        if( p_sys->tk[i] != NULL )
> > +            i_ts_max = __MAX( i_ts_max, p_sys->tk_pcr[i] );
> > +    }
> >
> >      int64_t i_ts_min = INT64_MAX;
> >      for( int i = 0; i < p_sys->i_tk; i++ )
> >      {
> > -        if( p_sys->tk_pcr[i] > VLC_TS_INVALID && p_sys->tk_pcr[i] + 10 *
> > CLOCK_FREQ >= i_ts_max )
> > +        if( p_sys->tk[i] != NULL &&
> > +                p_sys->tk_pcr[i] > VLC_TS_INVALID &&
> > +                p_sys->tk_pcr[i] + 10 * CLOCK_FREQ >= i_ts_max )
> >              i_ts_min = __MIN( i_ts_min, p_sys->tk_pcr[i] );
> >      }
> >      if( i_ts_min >= p_sys->i_pcr )
> > --
> > 2.10.1 (Apple Git-78)
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> > Email had 1 attachment:
> > + 0001-demux-avformat-do-not-take-account-of-invalid-stream.patch
> >   2k (text/plain)
>
>
> --
> Jean-Baptiste Kempf -  President
> +33 672 704 734
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170324/a6a7c40c/attachment.html>


More information about the vlc-devel mailing list