[FFmpeg-devel] [PATCH 1/2] avcodec/h264_ps: Check for truncation at fixed_frame_rate_flag

Michael Niedermayer michael at niedermayer.cc
Tue Dec 17 01:53:36 EET 2019


On Mon, Dec 16, 2019 at 11:52:21AM +0100, Carl Eugen Hoyos wrote:
> Am Mo., 16. Dez. 2019 um 01:07 Uhr schrieb James Almer <jamrial at gmail.com>:
> >
> > On 12/15/2019 9:03 PM, Carl Eugen Hoyos wrote:
> > > Am Mo., 16. Dez. 2019 um 01:00 Uhr schrieb James Almer <jamrial at gmail.com>:
> > >>
> > >> On 12/15/2019 8:50 PM, Carl Eugen Hoyos wrote:
> > >>> Am So., 15. Dez. 2019 um 23:25 Uhr schrieb James Almer <jamrial at gmail.com>:
> > >>>>
> > >>>> On 12/15/2019 7:00 PM, Michael Niedermayer wrote:
> > >>>>> Fixes: Ticket7249 (No longer displaying a scary red message)
> > >>>>>
> > >>>>> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > >>>>> ---
> > >>>>>  libavcodec/h264_ps.c | 4 ++++
> > >>>>>  1 file changed, 4 insertions(+)
> > >>>>>
> > >>>>> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> > >>>>> index e8738d8502..74f12f8979 100644
> > >>>>> --- a/libavcodec/h264_ps.c
> > >>>>> +++ b/libavcodec/h264_ps.c
> > >>>>> @@ -203,6 +203,10 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
> > >>>>>              sps->num_units_in_tick = num_units_in_tick;
> > >>>>>              sps->time_scale = time_scale;
> > >>>>>          }
> > >>>>> +        if (get_bits_left(gb) == 0) {
> > >>>>
> > >>>> Doing this check here sounds like it's tailored specifically for the
> > >>>> sample in the ticket. What if another file is truncated one bit after
> > >>>> this point? Or one bit before? You will get the scary red message for
> > >>>> it. Will you also add a check for it?
> > >>>> We can't clutter this file with new get_bits_left() checks every time a
> > >>>> user shares their broken samples with us just to get a less scary output
> > >>>> in their terminals.
> > >>>
> > >>> Do you know of another proprietary or open-source encoder that encodes
> > >>> streams with such a truncation?
> > >>
> > >> There was an old hevc encoder that did something like that. We ended up
> > >> adding a workaround for it as well.
> > >
> > >> And i can imagine capturing a
> > >> transport stream with bad network conditions could result in all kinds
> > >> randomly placed truncation.
> > >
> > > I don't think a "random" truncation as produced by reception or
> > > network issues can lead to similar messages as in the ticket.
> >
> > Can you elaborate why? If a sample stored in some container is truncated
> > in the VUI one bit after this point, will it not still print the
> > overread error level log message?
> 
> But not continuously.

I could imagine some global header being truncated for some reason and
then that truncated header being repeated with each random access point.

PS: off topic but i have a problem with receiving mails from james ATM 
(didnt receive the 2 mails you replied to yet)

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191217/acb8f239/attachment.sig>


More information about the ffmpeg-devel mailing list