After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705598 - regression h264parse: incorrect keyframe/delta-unit detection
regression h264parse: incorrect keyframe/delta-unit detection
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal major
: 1.1.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-07 07:33 UTC by Edward Hervey
Modified: 2013-08-29 10:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
h264parse: Use slice type to determine if frame is keyframe (1.93 KB, patch)
2013-08-07 16:44 UTC, Edward Hervey
committed Details | Review

Description Edward Hervey 2013-08-07 07:33:09 UTC
In the legacy h264parser (pre-baseparse), detecting whether a frame/buffer was a delta-unit or not was based on the slice_type whereas in the new parser it is based on whether the input contains a SPS or PPS or IDR.

The new behaviour is wrong since you can have streams that have new PPS on every frame, resulting in all output buffers being marked as keyframes.

The previous (correct) behaviour was to check the slice_type, and if it was 2,4,7 or 9 it was considered as a keyframe, else as a delta unit.

Amongst other things this breaks (re)muxing of h264 in matroska (all frames are considered keyframes and only one cue/index entry is created).
Comment 1 Edward Hervey 2013-08-07 16:44:05 UTC
Created attachment 251090 [details] [review]
h264parse: Use slice type to determine if frame is keyframe

This is the same behaviour as pre-baseparse-refactoring
Comment 2 Sebastian Dröge (slomo) 2013-08-08 10:26:05 UTC
Review of attachment 251090 [details] [review]:

::: gst/videoparsers/gsth264parse.c
@@ -477,3 @@
   /* we have a peek as well */
   nal_type = nalu->type;
-  h264parse->keyframe |= NAL_TYPE_IS_KEY (nal_type);

Maybe also get rid of that confusing and wrong macro then? ;)
Comment 3 Edward Hervey 2013-08-09 06:44:13 UTC
commit 8074a48594acd17eaa2a2e7ea3fd03d85f41a664
Author: Edward Hervey <bilboed@bilboed.com>
Date:   Wed Aug 7 09:04:39 2013 +0200

    h264parse: Use slice type to determine if frame is keyframe
    
    This is the same behaviour as pre-baseparse-refactoring
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705598
Comment 4 Tim-Philipp Müller 2013-08-09 14:10:07 UTC
Two questions:

 - why not use the macros and enums from gsth264parse.h ?
   e.g. GST_H264_IS_I_SLICE() and GST_H264_*_SLICE

 - does a slice always start at the top (line 0)? If not, should
   we only mark those slices as keyframes?
Comment 5 Tim-Philipp Müller 2013-08-28 17:58:11 UTC
> Two questions:

Edward: ping? ^^
Comment 6 Edward Hervey 2013-08-29 07:58:58 UTC
(In reply to comment #4)
> Two questions:
> 
>  - why not use the macros and enums from gsth264parse.h ?
>    e.g. GST_H264_IS_I_SLICE() and GST_H264_*_SLICE

  Because I didn't realize those macros existed :)

> 
>  - does a slice always start at the top (line 0)? If not, should
>    we only mark those slices as keyframes?

  Good question, I'm not sure. That being said, marking only some slices as keyframes sound a bit weird (key-frame, not key-slice).
Comment 7 Tim-Philipp Müller 2013-08-29 08:27:50 UTC
> >  - does a slice always start at the top (line 0)? If not, should
> >    we only mark those slices as keyframes?
> 
>   Good question, I'm not sure. That being said, marking only some slices as
> keyframes sound a bit weird (key-frame, not key-slice).

I think if a key unit is split across multiple buffers, we would/should only mark the first buffer as a key unit, not all of them.

Think of things like multifdsink that basically keeps data back to the last key unit so it can burst on a client connect, for example. If we marked all buffers as key units, then it would probably throw away the first one and only keep the last chunk, meaning the client will only get a partial frame as key unit on connect.
Comment 8 Tim-Philipp Müller 2013-08-29 08:38:47 UTC
Maybe we need an additional flag to mark other re-sync units that aren't full keyframes, e.g. for the intra-refresh case - then multifdsink could always keep enough buffers to deliver a whole fresh frame on burst, but a decoder in a live videoconferencing scenario could start decoding on the intra-refresh already to show some pixels.
Comment 9 Sebastian Dröge (slomo) 2013-08-29 10:42:50 UTC
All not full-sync-points should have the DELTA flag set. Everything else will break assumptions everywhere right now. Adding additional flags for describing more fine-grained sync units would be useful nonetheless. Or a new meta? :) Make that a different bug though.


Edward, can you update your patch to use the macros? :)