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 783588 - vaapidecoder: Add framework for codec-specific properties
vaapidecoder: Add framework for codec-specific properties
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
P1
Depends on:
Blocks: 732265 732266 762509
 
 
Reported: 2017-06-09 10:19 UTC by Orestis Floros
Modified: 2017-07-10 17:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Framework to support decoder-type-specific properties (21.36 KB, patch)
2017-06-14 03:04 UTC, Matt Staples
rejected Details | Review
vaapidecode: add properties callbacks in decoders map (3.21 KB, patch)
2017-06-14 16:36 UTC, Víctor Manuel Jáquez Leal
none Details | Review
gstvaapidecode_props: add skeleton for h264 decoder properties (5.85 KB, patch)
2017-06-14 16:36 UTC, Víctor Manuel Jáquez Leal
none Details | Review
libs: decoder: h264: add getter/setter for low latency mode (2.65 KB, patch)
2017-06-14 16:36 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapidecode_props: h264: add low latency property (2.28 KB, patch)
2017-06-14 16:36 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapidecode: properties callback in decoders map (2.77 KB, patch)
2017-07-06 18:02 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapidecode_props: add skeleton for h264 decoder properties (5.62 KB, patch)
2017-07-06 18:03 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapidecode_props: h264: add low latency property (3.24 KB, patch)
2017-07-06 18:03 UTC, Víctor Manuel Jáquez Leal
none Details | Review
libs: decoder: h264: add getter/setter for low latency mode (2.65 KB, patch)
2017-07-06 18:03 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapidecode: set h264 low latency to decoder (1.37 KB, patch)
2017-07-06 18:03 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapidecode: properties callback in decoders map (2.77 KB, patch)
2017-07-07 17:44 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapidecode_props: add skeleton for h264 decoder properties (5.62 KB, patch)
2017-07-07 17:44 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapidecode_props: h264: add low latency property (3.29 KB, patch)
2017-07-07 17:44 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
libs: decoder: h264: add getter/setter for low latency mode (2.65 KB, patch)
2017-07-07 17:44 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapidecode: set h264 low latency to decoder (1.37 KB, patch)
2017-07-07 17:44 UTC, Víctor Manuel Jáquez Leal
committed Details | Review

Description Orestis Floros 2017-06-09 10:19:59 UTC
This is needed for Bug 732265, Bug 732266 and Bug 762509:
These bugs need to add codec-specific properties ("base-only" and "low-latency") but there is no framework in place to properly support this.

Matt has proposed a patch in Bug 762509 but this bug should help separate this issue with the original purpose of 762509.
Comment 1 Matt Staples 2017-06-14 03:04:12 UTC
Created attachment 353726 [details] [review]
Framework to support decoder-type-specific properties

Copy of my previous patch to bug 762509, but modified to use a generic, example property instead of one specific to that bug.  (The expectation is that the example property would get removed before anything got committed, but it helps clarify how the framework works.)
Comment 2 Víctor Manuel Jáquez Leal 2017-06-14 10:42:25 UTC
Review of attachment 353726 [details] [review]:

This patch shall be split in several patches because it mixes different unrelated things, such as the decoder properties handling and the moving preprocessor macros.
Comment 3 Víctor Manuel Jáquez Leal 2017-06-14 10:44:07 UTC
Review of attachment 353726 [details] [review]:

There's a semantic boarder among gst/vaapi and gst-libs/gst/vaapi

gst/vaapi is for gstreamer related stuff, like these properties

gst-libs/gst/vaapi is for parsing and VA related stuff
Comment 4 Víctor Manuel Jáquez Leal 2017-06-14 16:36:33 UTC
Created attachment 353751 [details] [review]
vaapidecode: add properties callbacks in decoders map
Comment 5 Víctor Manuel Jáquez Leal 2017-06-14 16:36:38 UTC
Created attachment 353752 [details] [review]
gstvaapidecode_props: add skeleton for h264 decoder properties
Comment 6 Víctor Manuel Jáquez Leal 2017-06-14 16:36:44 UTC
Created attachment 353753 [details] [review]
libs: decoder: h264: add getter/setter for low latency mode
Comment 7 Víctor Manuel Jáquez Leal 2017-06-14 16:36:49 UTC
Created attachment 353754 [details] [review]
vaapidecode_props: h264: add low latency property
Comment 8 Víctor Manuel Jáquez Leal 2017-06-14 16:44:01 UTC
These patches are a Request For Comments:

What do you think?

IMO is much more simpler than any other approach, though it doesn't handle common properties, as done in the encoders, but I consider they are not required.
Comment 9 Matt Staples 2017-06-15 02:44:47 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #2)
> Review of attachment 353726 [details] [review] [review]:
> 
> This patch shall be split in several patches because it mixes different
> unrelated things, such as the decoder properties handling and the moving
> preprocessor macros.

Sorry, I didn't mean to include the preprocessor changes to gstencoder_h264.c.  That was needed to get things compiling again after a recent git pull. It got checked into the same rev by accident.  (Although, I think that's addressing a separate, recently introduced bug.)

Was that the only unrelated item?  If so, I'll go ahead and pull that out and re-submit.
Comment 10 Matt Staples 2017-06-15 14:10:19 UTC
Review of attachment 353754 [details] [review]:

::: gst/vaapi/gstvaapidecode_props.c
@@ +49,3 @@
+  GstVaapiDecoderH264 *decoder =
+      GST_VAAPI_DECODER_H264 (GST_VAAPIDECODE (object)->decoder);
+

Wouldn't object->decoder be NULL here if this is called prior to starting the pipeline (as happens when setting properties via gst-launch-1.0)?

That's why my previous patch included the new 'props' object - it provides a way to get/set the values prior to the associated decoder object's creation.
Comment 11 Matt Staples 2017-06-15 14:21:33 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #8)
> These patches are a Request For Comments:
> 
> What do you think?
> 
> IMO is much more simpler than any other approach, though it doesn't handle
> common properties, as done in the encoders, but I consider they are not
> required.

I like this organization.  It nicely separates the roles of get/vaapi and get-libs/gst/vaapi.  

But see my review comments about the problems caused by the decoder object's getting constructed later than the initial property get/set calls are made.  (See gst_vaapidecode_reset and gst_vaapidecode_create in gstvaapidecode.c)

To that end, I like sreerenj's idea from comment #41 from bug 762509. It might  require a bit of redesign, but the basic idea is that instead of delaying the construction of decoder objects until caps are known, construct them earlier and then 'activate' them once caps are known.  That way the decoder objects are immediately available for property set/get, and we wouldn't need a separate object for holding property values in the interim.
Comment 12 Víctor Manuel Jáquez Leal 2017-07-06 18:02:58 UTC
Created attachment 355029 [details] [review]
vaapidecode: properties callback in decoders map
Comment 13 Víctor Manuel Jáquez Leal 2017-07-06 18:03:04 UTC
Created attachment 355030 [details] [review]
vaapidecode_props: add skeleton for h264 decoder properties
Comment 14 Víctor Manuel Jáquez Leal 2017-07-06 18:03:10 UTC
Created attachment 355031 [details] [review]
vaapidecode_props: h264: add low latency property

Adding support for private data.
Comment 15 Víctor Manuel Jáquez Leal 2017-07-06 18:03:17 UTC
Created attachment 355032 [details] [review]
libs: decoder: h264: add getter/setter for low latency mode
Comment 16 Víctor Manuel Jáquez Leal 2017-07-06 18:03:24 UTC
Created attachment 355033 [details] [review]
vaapidecode: set h264 low latency to decoder
Comment 17 Víctor Manuel Jáquez Leal 2017-07-06 18:06:28 UTC
Finally got some time to revisit this issue. The proposed strategy is quite the same as before (just a bit more self contained), but now a private structure is added using the gobject's magic.
Comment 18 Hyunjun Ko 2017-07-07 08:36:52 UTC
Review of attachment 355030 [details] [review]:

::: gst/vaapi/gstvaapidecode_props.c
@@ +1,2 @@
+/*
+ *  gstvaapidecode_props.h - VA-API decoders specific properties

typo :) _props.c
Comment 19 Víctor Manuel Jáquez Leal 2017-07-07 17:44:11 UTC
Created attachment 355109 [details] [review]
vaapidecode: properties callback in decoders map
Comment 20 Víctor Manuel Jáquez Leal 2017-07-07 17:44:17 UTC
Created attachment 355110 [details] [review]
vaapidecode_props: add skeleton for h264 decoder properties
Comment 21 Víctor Manuel Jáquez Leal 2017-07-07 17:44:23 UTC
Created attachment 355111 [details] [review]
vaapidecode_props: h264: add low latency property

Adding support for private data.
Comment 22 Víctor Manuel Jáquez Leal 2017-07-07 17:44:29 UTC
Created attachment 355112 [details] [review]
libs: decoder: h264: add getter/setter for low latency mode
Comment 23 Víctor Manuel Jáquez Leal 2017-07-07 17:44:35 UTC
Created attachment 355113 [details] [review]
vaapidecode: set h264 low latency to decoder
Comment 24 Matt Staples 2017-07-09 16:57:32 UTC
Review of attachment 355111 [details] [review]:

::: gst/vaapi/gstvaapidecode_props.c
@@ +41,3 @@
+  switch (prop_id) {
+    case GST_VAAPI_DECODER_H264_PROP_FORCE_LOW_LATENCY:
+      g_value_set_boolean (value, priv->is_low_latency);

Although it's not necessary for the low-latency property, this doesn't currently handle dynamic changes to the property value once the h264 decoder object has been constructed.  For future properties that might need it, is there a way to extend this to handle dynamic updates to an already-existing decoder object?
Comment 25 Víctor Manuel Jáquez Leal 2017-07-10 13:42:18 UTC
(In reply to Matt Staples from comment #24)
> Review of attachment 355111 [details] [review] [review]:
> 
> ::: gst/vaapi/gstvaapidecode_props.c
> @@ +41,3 @@
> +  switch (prop_id) {
> +    case GST_VAAPI_DECODER_H264_PROP_FORCE_LOW_LATENCY:
> +      g_value_set_boolean (value, priv->is_low_latency);
> 
> Although it's not necessary for the low-latency property, this doesn't
> currently handle dynamic changes to the property value once the h264 decoder
> object has been constructed.  For future properties that might need it, is
> there a way to extend this to handle dynamic updates to an already-existing
> decoder object?

Yes, you have access to the object, and the object contains the decoder, you just need the proper casts and validate if it is already created

like in the previous patch:

GstVaapiDecoderH264 *decoder =
      GST_VAAPI_DECODER_H264 (GST_VAAPIDECODE (object)->decoder);
if (decoder)
  gst_vaapi_decoder_h264_set_property (decoder, val);
Comment 26 Víctor Manuel Jáquez Leal 2017-07-10 17:42:56 UTC
Attachment 355109 [details] pushed as 207486a - vaapidecode: properties callback in decoders map
Attachment 355110 [details] pushed as 484033d - vaapidecode_props: add skeleton for h264 decoder properties
Attachment 355111 [details] pushed as f39b7e9 - vaapidecode_props: h264: add low latency property
Attachment 355112 [details] pushed as 28d1d04 - libs: decoder: h264: add getter/setter for low latency mode
Attachment 355113 [details] pushed as 551ae94 - vaapidecode: set h264 low latency to decoder
Also pushed 11f461fb - vaapidecode_props: h264: set low-latency in decoder