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 790628 - h264parse: put downstream caps first if possible on sink caps
h264parse: put downstream caps first if possible on sink caps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal blocker
: 1.13.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-11-20 17:15 UTC by Guillaume Desmottes
Modified: 2018-03-02 15:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
h264parse: put downstream caps first if possible on sink caps (5.37 KB, patch)
2017-11-20 17:16 UTC, Guillaume Desmottes
none Details | Review
h264parse: put downstream caps first if possible on sink caps (5.47 KB, patch)
2017-11-21 09:07 UTC, Guillaume Desmottes
committed Details | Review
h265parse: put downstream caps first if possible on sink caps (2.98 KB, patch)
2017-11-21 09:11 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2017-11-20 17:15:45 UTC
.
Comment 1 Guillaume Desmottes 2017-11-20 17:16:20 UTC
Created attachment 364061 [details] [review]
h264parse: put downstream caps first if possible on sink caps

Try prioritizing downstream's caps over upstream's if possible so the
parser can configured in "passthrough" if possible and save it from
doing useless conversions.
Comment 2 Guillaume Desmottes 2017-11-20 17:17:53 UTC
Once approved I'll do a similar patch for h265parse.
Comment 3 Sebastian Dröge (slomo) 2017-11-21 08:06:09 UTC
Review of attachment 364061 [details] [review]:

Generally looks good

::: gst/videoparsers/gsth264parse.c
@@ +2787,2 @@
   if (peercaps) {
+    GstCaps *pcopy = gst_caps_copy (peercaps);

This claims that peercaps can be NULL but they can't, right? The above code always sets it to something, so if anything they might be empty but never NULL

@@ +2804,3 @@
 
+  /* Try if we can put the downstream caps first */
+  remove_fields (peercaps, FALSE);

... otherwise if they could be NULL, this would fail. So please remove the if condition above, or otherwise there will be a coverity warning about this :)
Comment 4 Guillaume Desmottes 2017-11-21 09:07:01 UTC
Right, gst_pad_peer_query_caps() will never return NULL. Fixing.
Comment 5 Guillaume Desmottes 2017-11-21 09:07:24 UTC
Created attachment 364102 [details] [review]
h264parse: put downstream caps first if possible on sink caps

Try prioritizing downstream's caps over upstream's if possible so the
parser can configured in "passthrough" if possible and save it from
doing useless conversions.
Comment 6 Guillaume Desmottes 2017-11-21 09:11:30 UTC
Created attachment 364104 [details] [review]
h265parse: put downstream caps first if possible on sink caps

Try prioritizing downstream's caps over upstream's if possible so the
parser can configured in "passthrough" if possible and save it from
doing useless conversions.

Exact same change as the one I just did in h264parse.
Comment 7 Sebastian Dröge (slomo) 2017-11-22 15:38:27 UTC
Attachment 364102 [details] pushed as d5067b4 - h264parse: put downstream caps first if possible on sink caps
Attachment 364104 [details] pushed as 0087485 - h265parse: put downstream caps first if possible on sink caps
Comment 8 Sebastian Dröge (slomo) 2017-11-22 15:42:19 UTC
Review of attachment 364102 [details] [review]:

::: tests/check/elements/h264parse.c
@@ +363,3 @@
+  GstElement *parser;
+  GstPad *sink, *src;
+  GstCaps *src_caps, *sink_caps;;

This double-semicolon did not compile with the autotools build system, fixed before pushing :)

The compiler warning flags are different between meson and autotools.
Comment 9 Nicolas Dufresne (ndufresne) 2017-12-21 02:08:04 UTC
This causes the caps to be pushed twice, once without the interlace-mode and the second with it.
Comment 10 Sebastian Dröge (slomo) 2017-12-21 09:49:16 UTC
We can only know the interlace mode from the stream itself and not the codec_data? In that case this patch has to be reverted and there's nothing better we can do.
Comment 11 Nicolas Dufresne (ndufresne) 2017-12-21 13:53:21 UTC
When I looked last, I was quite convinced that this information is in the codec data. But there is a lot of embedded if, and only one branch adding the interlace mode. So I suppose that we don't visit the right branch on first pass, and then run out of time. Guillaume as been sick pretty much all week and could not look at it yet.

For sure we should revert before 1.13.1 if not fixed on time.
Comment 12 Tim-Philipp Müller 2017-12-21 14:12:09 UTC
Do you have an example input caps string and/or short gdp snippet that reproduces the problem?
Comment 13 Nicolas Dufresne (ndufresne) 2017-12-21 14:41:23 UTC
For me caps are sent twice with any mov containing h264.
Comment 14 Nicolas Dufresne (ndufresne) 2017-12-21 14:43:13 UTC
I notice because v4l2h264dec does not support renegotiation ATM, working on it. I also don't have code to differentiate meaningless caps change like this.
Comment 15 Sebastian Dröge (slomo) 2018-02-26 11:17:57 UTC
I can't reproduce this here with H264/MP4 and "filesrc ! qtdemux ! h264parse ! fakesink" or also "filesrc ! decodebin ! fakesink". The caps are only sent once on the srcpad of h264parse according to the gst-launch-1.0 -v output.

Is there still a problem here or did it get solved in the meantime?
Comment 16 Nicolas Dufresne (ndufresne) 2018-02-26 18:47:00 UTC
I've been confusing with bug 790709 , I believe we can close this one ?
Comment 17 Nicolas Dufresne (ndufresne) 2018-03-02 15:43:14 UTC
Review of attachment 364102 [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 18 Nicolas Dufresne (ndufresne) 2018-03-02 15:43:24 UTC
Review of attachment 364104 [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 19 Nicolas Dufresne (ndufresne) 2018-03-02 15:44:07 UTC
arg, sorry.