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 735804 - smpte: Creates incomplete raw video caps
smpte: Creates incomplete raw video caps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 1.4.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-01 11:36 UTC by RaviKiran
Modified: 2014-09-04 09:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set caps sent by upstream element (2.36 KB, patch)
2014-09-01 11:36 UTC, RaviKiran
needs-work Details | Review
compare v1 and v2, create caps from one of GstVideoInfo (1.53 KB, patch)
2014-09-02 08:18 UTC, RaviKiran
committed Details | Review

Description RaviKiran 2014-09-01 11:36:24 UTC
Created attachment 284993 [details] [review]
Set caps sent by upstream element

Example pipeline (mentioned below) throws errors as caps negotiation fails.
gst-launch-1.0 -v videotestsrc pattern=1 ! smpte name=s border=20000 type=234 duration=2000000000 ! videoconvert ! ximagesink videotestsrc ! s. 


Solution patch attached. Please review.
Comment 1 Sebastian Dröge (slomo) 2014-09-01 11:39:56 UTC
Review of attachment 284993 [details] [review]:

::: gst/smpte/gstsmpte.c
@@ +302,3 @@
 
+  if (smpte->src_caps == NULL
+      || gst_caps_is_equal (caps, smpte->src_caps) == FALSE) {

Don't check gbooleans with ==. Just do || gst_caps_is_equal())

@@ +386,3 @@
+  if (smpte->src_caps) {
+    gst_caps_replace (&smpte->src_caps, NULL);
+    smpte->src_caps = NULL;

The caps should already be cleared in PAUSED→READY state change

@@ +532,3 @@
       GstSegment segment;
 
+      gst_pad_set_caps (smpte->srcpad, smpte->src_caps);

Why not just forward the caps directly from the setcaps function by calling gst_pad_set_caps() from there? Also what do you do if both sinkpads have different caps that are nonetheless compatible for the smpte element?
Comment 2 Sebastian Dröge (slomo) 2014-09-01 11:42:37 UTC
Also a bigger question is why caps negotiation fails, there's probably a deeper problem here
Comment 3 RaviKiran 2014-09-02 05:05:04 UTC
Thanks for the review. Here is my understanding -

>>why caps negotiation fails
caps nego failed because videotestsrc produced caps including properties "pixel-aspect-ratio" and "interlace-mode"
however in smpte we create hard-wired caps without those 2 properties. When I added those properties, pipeline worked.
Is it a good idea to modify the pad template and implement query function to handle QUERY_CAPS ?

>>Why not just forward the caps directly from the setcaps function by calling gst_pad_set_caps() from there?
When we receive caps event, stream-start event isn't initated yet. So, that would cause sticky-event misordering.

>> Also what do you do if both sinkpads have different caps that are nonetheless compatible for the smpte element?
SMPTE documentation says - smpte can accept I420 video streams with the *same* width, height and framerate. 

Please let me know if got something wrong.
Comment 4 Sebastian Dröge (slomo) 2014-09-02 06:32:41 UTC
No, seems correct. However it also should check that pixel-aspect-ratio, interlace-mode and other raw video properties are the same. Basically needs to check if the GstVideoInfo of both inputs are equal.

And then you can simply create the caps from the GstVideoInfo of one of the inputs here.
Comment 5 RaviKiran 2014-09-02 08:18:28 UTC
Created attachment 285117 [details] [review]
compare v1 and v2, create caps from one of GstVideoInfo

New patch attached. Please review. Thanks.
Comment 6 Sebastian Dröge (slomo) 2014-09-04 07:47:50 UTC
commit ea43ef214a77a0219af9a9be922042fbf5e53f15
Author: Ravi Kiran K N <ravi.kiran@samsung.com>
Date:   Tue Sep 2 13:52:43 2014 +0530

    smpte: Check if input caps are the same and create output caps from video info
    
    This makes sure that also properties like the pixel-aspect-ratio are the same
    between both streams and that the output caps contain all fields necessary for
    complete video caps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735804