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 795415 - jpegenc: Disallow upstream renegotiation if downstream doesn't support it
jpegenc: Disallow upstream renegotiation if downstream doesn't support it
Status: RESOLVED INVALID
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
unspecified
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 795420
 
 
Reported: 2018-04-20 20:22 UTC by Thibault Saunier
Modified: 2018-04-22 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
jpegenc: Disallow upstream renegotiation if downstream doesn't support it (3.24 KB, patch)
2018-04-20 20:22 UTC, Thibault Saunier
none Details | Review
jpegenc: Disallow upstream renegotiation if downstream doesn't support it (3.24 KB, patch)
2018-04-21 12:21 UTC, Thibault Saunier
none Details | Review

Description Thibault Saunier 2018-04-20 20:22:03 UTC
See commit message.
Comment 1 Thibault Saunier 2018-04-20 20:22:09 UTC
Created attachment 371173 [details] [review]
jpegenc: Disallow upstream renegotiation if downstream doesn't support it

Currently when upstream tries to renegotiate the input format, we just
let it decide whatever it wants solely based on what jpegenc supports,
not taking into account what downstream can do.

This patch checks if downstream supports renegotiation by querying
downstream caps and checking if they are fixed, which
implies nothing else will be accepted.

Maybe in some cases we could be able to renegotiate some parts
of upstream format without changing downstream caps, but better safe
than sorry for now.
Comment 2 Sebastian Dröge (slomo) 2018-04-21 10:33:57 UTC
Comment on attachment 371173 [details] [review]
jpegenc: Disallow upstream renegotiation if downstream doesn't support it

Why is this necessary at all? The default getcaps should query downstream and then convert the caps accordingly (with the proxy getcaps function). This should have the same effect.
Comment 3 Sebastian Dröge (slomo) 2018-04-21 10:35:02 UTC
Review of attachment 371173 [details] [review]:

::: ext/jpeg/gstjpegenc.c
@@ +581,3 @@
+
+    downstream_caps = gst_pad_peer_query_caps (enc->srcpad, NULL);
+    if (gst_caps_is_fixed (downstream_caps)) {

image/jpeg are also fixed caps :)

@@ +587,3 @@
+
+      if (filter)
+        ret = gst_caps_intersect (input_caps, filter);

gst_caps_intersect_full(filter, input_caps, GST_CAPS_INTERSECT_FIRST)
Comment 4 Thibault Saunier 2018-04-21 12:20:41 UTC
(In reply to Sebastian Dröge (slomo) from comment #2)
> Comment on attachment 371173 [details] [review] [review]
> jpegenc: Disallow upstream renegotiation if downstream doesn't support it
> 
> Why is this necessary at all? The default getcaps should query downstream
> and then convert the caps accordingly (with the proxy getcaps function).
> This should have the same effect.

The format is not availaible downstream so the default implementation uses the first specified, which might lead to the not negotiated error.

(In reply to Sebastian Dröge (slomo) from comment #3)
> Review of attachment 371173 [details] [review] [review]:
> 
> ::: ext/jpeg/gstjpegenc.c
> @@ +581,3 @@
> +
> +    downstream_caps = gst_pad_peer_query_caps (enc->srcpad, NULL);
> +    if (gst_caps_is_fixed (downstream_caps)) {
> 
> image/jpeg are also fixed caps :)

That doesn't sound possible to have upstream fixed and downstream fixed without all the required fields.

> @@ +587,3 @@
> +
> +      if (filter)
> +        ret = gst_caps_intersect (input_caps, filter);
> 
> gst_caps_intersect_full(filter, input_caps, GST_CAPS_INTERSECT_FIRST)

Fixed.
Comment 5 Thibault Saunier 2018-04-21 12:21:46 UTC
Created attachment 371211 [details] [review]
jpegenc: Disallow upstream renegotiation if downstream doesn't support it

Currently when upstream tries to renegotiate the input format, we just
let it decide whatever it wants solely based on what jpegenc supports,
not taking into account what downstream can do.

This patch checks if downstream supports renegotiation by querying
downstream caps and checking if they are fixed, which
implies nothing else will be accepted.

Maybe in some cases we could be able to renegotiate some parts
of upstream format without changing downstream caps, but better safe
than sorry for now.
Comment 6 Nicolas Dufresne (ndufresne) 2018-04-21 14:20:45 UTC
We should definatly fix renegotiation in this encoder, it is trivial case as it's key frame only.
Comment 7 Thibault Saunier 2018-04-22 13:52:44 UTC
This actually is the consequence of https://bugzilla.gnome.org/show_bug.cgi?id=795463