[FFmpeg-devel] [PATCH] avformat/mpegts: skip subtitle PES packets if PCR not available

Jan Ekström jeebjp at gmail.com
Sat Dec 15 20:53:25 EET 2018


On Sat, Dec 15, 2018 at 5:13 PM Jan Ekström <jeebjp at gmail.com> wrote:
>
> On Sat, Dec 15, 2018 at 4:57 PM Marton Balint <cus at passwd.hu> wrote:
> >
> > On Sat, 15 Dec 2018, Jan Ekström wrote:
> >
> > > Fixes issues when a subtitle packet is received before PCR for the
> > > program has been received, leading to wildly jumping timestamps
> > > on the lavf client side as well as in the re-ordering logic.
> > >
> > > This usually happens in case of multiplexes where the PCR of a
> > > program is not taken into account with subtitle tracks' DTS/PTS.
> > >
> > > In case someone actually wants to pass through all received packets,
> > > the behavior can be controlled with an AVOption.
> > > ---
> > > libavformat/mpegts.c | 22 ++++++++++++++++++++++
> > > 1 file changed, 22 insertions(+)
> >
> > If PCR is unknown, then it is better to return the packets with
> > AV_NOPTS_VALUE pts and dts instead of skipping them entirely. Or is there
> > a case which is not fixed by this approach?
> >
> > IMHO you might even do this unconditionally as long as "fix_teletext_pts"
> > option is set (which is the default).
> >
> > Regards,
> > Marton
>
> I did think about that, but I didn't remember the semantics of
> AV_NOPTS_VALUE in various cases, and I hadn't tested it so the initial
> idea was to just skip or buffer those packets (until you had PCR).
> Latter sounded not too nice to implement with an unknown amount of
> buffering occuring, so I chose this way for the initial patch.
>
> I will have to give it a try and see how it goes.
>
> Jan

Alright, this worked well enough so I posted a new patch that unsets
DTS/PTS from the subtitle packets by using AV_NOPTS_VALUE if PCR has
not yet been received.

Jan


More information about the ffmpeg-devel mailing list