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 790709 - h264parse: early set src caps when input is avc
h264parse: early set src caps when input is avc
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-11-22 13:52 UTC by Guillaume Desmottes
Modified: 2018-11-03 14:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
h264parse: early set src caps when input is avc (1.35 KB, patch)
2017-11-22 13:52 UTC, Guillaume Desmottes
none Details | Review
h265parse: early set src caps when input not byte-stream (1.35 KB, patch)
2017-11-22 16:29 UTC, Guillaume Desmottes
needs-work Details | Review
h264parse: early set src caps when input is avc (1.72 KB, patch)
2018-03-15 15:36 UTC, Guillaume Desmottes
none Details | Review

Description Guillaume Desmottes 2017-11-22 13:52:25 UTC
.
Comment 1 Guillaume Desmottes 2017-11-22 13:52:53 UTC
Created attachment 364189 [details] [review]
h264parse: early set src caps when input is avc

When input is in AVC format there is no need to wait for the first buffer
before setting src caps. We already have all the information from the
input codec_data.

This allow us to already configure downstream elements allowing them,
for example, to already allocate their internal buffers as they know
the format of the input they are about to receive.
Comment 2 Sebastian Dröge (slomo) 2017-11-22 15:42:53 UTC
Comment on attachment 364189 [details] [review]
h264parse: early set src caps when input is avc

Same for h265parse I guess?
Comment 3 Guillaume Desmottes 2017-11-22 16:29:45 UTC
Created attachment 364212 [details] [review]
h265parse: early set src caps when input not byte-stream

When input is not in byte-stream format there is no need to wait for the first
buffer before setting src caps. We already have all the information from the
input codec_data.

This allow us to already configure downstream elements allowing them,
for example, to already allocate their internal buffers as they know
the format of the input they are about to receive.

Same change as the one I just did in h264parse.
Comment 4 Sebastian Dröge (slomo) 2017-11-24 09:13:27 UTC
Attachment 364189 [details] pushed as 5ac886d - h264parse: early set src caps when input is avc
Attachment 364212 [details] pushed as 93d29e8 - h265parse: early set src caps when input not byte-stream
Comment 5 Nicolas Dufresne (ndufresne) 2017-12-08 00:12:27 UTC
These patches causes a regression, the caps are not pushed twice. Once without interlace-mode and then later on with the interlace-mode set. The fact the caps are different makes it a bit worst as it force a renegotiation. The pipeline I've used to test:

GST_DEBUG="*EVENT*:5" gst-launch-1.0 filesrc location=/home/nicolas/Vidéos/Tests/tintin-tlr2_h1080p.mov ! qtdemux ! h264parse ! video/x-h264,stream-format=byte-stream ! fakesink 2>&1 | grep "type caps"
Comment 6 Nicolas Dufresne (ndufresne) 2017-12-08 00:13:17 UTC
You can also test with any of the .mov of BigBuck bunny that is H264 encoded.
Comment 7 Sebastian Dröge (slomo) 2018-02-26 11:19:54 UTC
This is still a problem from what I can see. Nicolas, Guillaume, is anybody of you working on this or should we revert the commits for 1.14?

Also this seems loosely related to https://bugzilla.gnome.org/show_bug.cgi?id=790628 but I can't reproduce that one.
Comment 8 Guillaume Desmottes 2018-02-26 11:23:29 UTC
I'm pretty busy atm so can't promise you I'll have time to look at it soon.
So yeah go ahead and revert, I'll resume this work as soon as I have some time.
Comment 9 Nicolas Dufresne (ndufresne) 2018-02-26 14:32:30 UTC
I'll make sure I can still reproduce. Downstream caps could make a difference.
Comment 10 Nicolas Dufresne (ndufresne) 2018-02-26 15:54:29 UTC
Could test on the DB410c, but I could not reproduce, and I tried with various downstream caps, no difference.
Comment 11 Nicolas Dufresne (ndufresne) 2018-02-26 15:54:52 UTC
oops, "could not test on DB410c".
Comment 12 Sebastian Dröge (slomo) 2018-02-26 18:22:00 UTC
This one is reproducible with the pipeline in comment 5. I can't reproduce bug #790628 though
Comment 13 Nicolas Dufresne (ndufresne) 2018-03-02 15:45:45 UTC
Review of attachment 364189 [details] [review]:

commit 7e45b9f03fdb89618eee2b3277173d94b547cc15
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Fri Mar 2 10:37:45 2018 -0500

    Revert "h264parse: early set src caps when input is avc"
    
    This reverts commit 5ac886d85aab4b919f84fb80e2d1ef36dc8e647d.
Comment 14 Nicolas Dufresne (ndufresne) 2018-03-02 15:45:56 UTC
Review of attachment 364212 [details] [review]:

commit 9865904d8820c43a16d2d655ba31d155bb1ac581 (HEAD -> master)
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Fri Mar 2 10:37:53 2018 -0500

    Revert "h265parse: early set src caps when input not byte-stream"
    
    This reverts commit 93d29e80300f566b7a8e7d86beecb578fe03821c.
Comment 15 Nicolas Dufresne (ndufresne) 2018-03-02 15:46:44 UTC
Reverted for the release, see comment #5 on how to reproduce the regressions.
Comment 16 Guillaume Desmottes 2018-03-15 15:35:48 UTC
I think the problem was we were ignoring the sink caps when early setting the src caps. If I fix that I'm no longer able to reproduce Nicolas's regression as we no longer loose fields like interlace-mode.

Here is the patch. If that looks ok to you I'll provide a similar one for h265parse.
Comment 17 Guillaume Desmottes 2018-03-15 15:36:00 UTC
Created attachment 369741 [details] [review]
h264parse: early set src caps when input is avc

When input is in AVC format there is no need to wait for the first buffer
before setting src caps. We already have all the information from the
input codec_data.

This allow us to already configure downstream elements allowing them,
for example, to already allocate their internal buffers as they know
the format of the input they are about to receive.

This patch is pretty similar to 5ac886d85aab4b919f84fb80e2d1ef36dc8e647d
which has been reverted but now we carry over fields from the sink caps.
By doing so we no longer end up with partial caps which were updated
later and so was triggering a renegotiation.
Comment 18 Nicolas Dufresne (ndufresne) 2018-03-15 15:45:50 UTC
I've learn a lot since I first look at this patch, I'm not going to say this how it's implemented, but this is clearly a lie. I won't split anything in for 1.14 because this requires more work.

The case that is not handled here is if there is multiple SPS. If this is the case, you cannot do that, you have to wait for the frame, and look at which SPS is to be used in order to update the caps (if you don't want to cause a renegotiation). We just need code to catch this case, and also make sure we do check the SPS index in the frame header.
Comment 19 Guillaume Desmottes 2018-03-19 13:49:27 UTC
Isn't the demuxer going to use the first SPS as codec_data?
If it does then I think we're good as we already support SPS changes from I understand from the code.
Comment 20 Nicolas Dufresne (ndufresne) 2018-03-19 22:03:23 UTC
No, all sps are together. It's the frames that specify which one becomes active. I'm not sure this works in practice, bits that how it's designed. This way you can have the decoder prepared, and switching can be faster.
Comment 21 GStreamer system administrator 2018-11-03 14:15:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/633.