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 655112 - videomaxrate: add "max-rate" property and improve caps negotiation
videomaxrate: add "max-rate" property and improve caps negotiation
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-07-22 11:33 UTC by Sjoerd Simons
Modified: 2011-10-29 15:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (7.15 KB, patch)
2011-07-22 11:33 UTC, Sjoerd Simons
none Details | Review
Updated patch, support more types of caps (8.31 KB, patch)
2011-08-08 13:01 UTC, Sjoerd Simons
none Details | Review
videorate: Add more strict caps negotiation (4.41 KB, patch)
2011-09-19 10:52 UTC, Sjoerd Simons
needs-work Details | Review
videorate: Add test for caps negotiation (6.49 KB, patch)
2011-09-19 10:53 UTC, Sjoerd Simons
none Details | Review
Add maxrate property and make caps negotiation more strict (19.36 KB, patch)
2011-09-19 18:16 UTC, Sjoerd Simons
committed Details | Review

Description Sjoerd Simons 2011-07-22 11:33:14 UTC
Created attachment 192450 [details] [review]
proposed patch

Currently videomaxrate always claims it's source and sink caps include framerates going from [0/1..maxint/1], but the only thing it can do is drop extra frames. So it's not actually able to transform an input framerate of say 10 fps to 15 fps.

Furthermore for use-cases where you want to framerate to be adjusted to a specific maximum dynamically the current need to dynamically adjust a capsfilter behind the maxrate is very cumbersome as there is always a race between setting the filter, the renegotiation happening and buffers with the old caps still being pushed through the capsfilter. Allowing the capsfilter to still have the old caps as a second option doesn't really work as that doesn't guarantee the right re-negotiation will happen (e.g. the old-caps might allow for a pass-through, which base-transform prefers).

To solve these issues. Add a property to dynamically adjust the internal maximum rate of videomaxrate, which can ensure the right caps negotation occurs and change the caps to prefer to output a framerate in the range the source provides, but can deliver anything from 0 to MIN( configured maximum, maximum framerate of the source). And as input we require at least the minium the sink requires and prefer a framerate in the range we want to output, but can accept anything that's higher as well.
Comment 1 David Schleef 2011-07-27 05:08:49 UTC
Could I maybe convince you to add a few simple pipeline tests to the testsuite for this?
Comment 2 Sjoerd Simons 2011-08-08 13:01:25 UTC
Created attachment 193417 [details] [review]
Updated patch, support more types of caps

Updated patch, use a different way of clamping. by intersecting the incoming caps with the widest framerate range so we can easily get the intersection
Comment 3 Sjoerd Simons 2011-08-08 13:02:18 UTC
(In reply to comment #1)
> Could I maybe convince you to add a few simple pipeline tests to the testsuite
> for this?

You can, quite easily :). I didn't have the time to do that when i wrote the original patch unfortunately, but i'm hoping to have some time for adding those this week.
Comment 4 Sjoerd Simons 2011-08-15 16:17:30 UTC
Updated in branch: http://cgit.collabora.com/git/user/sjoerd/gst-plugins-bad.git/log/?h=videomaxrate

Testcase added and some small bugfix done.
Comment 5 Sebastian Dröge (slomo) 2011-08-16 06:11:14 UTC
Is this still needed now that videorate has support for generating a stream with a maximum bitrate? Do the same changes apply to videorate too?
Comment 6 Olivier Crête 2011-08-18 09:27:02 UTC
Actually, I think videorate should be ported over to basetransform and made to support upstream caps negotiation and this code should go in there.
Comment 7 Sjoerd Simons 2011-08-22 16:34:53 UTC
Porting videorate over to basetransform makes it ignore the order of the caps though, which is a nice feature of videorate.
Comment 8 Sjoerd Simons 2011-08-25 10:54:30 UTC
(In reply to comment #6)
> Actually, I think videorate should be ported over to basetransform and made to
> support upstream caps negotiation and this code should go in there.

Patch to support the current videorate code to basetransform is available in #657319
Comment 9 Sebastian Dröge (slomo) 2011-08-26 08:01:52 UTC
Should this be marked as a duplicate of bug #657319 then?
Comment 10 Sjoerd Simons 2011-08-26 11:12:44 UTC
(In reply to comment #9)
> Should this be marked as a duplicate of bug #657319 then?

Neh, let's keep #657319 for porting the current videorate code to basetransform, when that's landed i'll update the patches here to apply on top of videorate. smaller chunks should be hopefully easier to track
Comment 11 Sebastian Dröge (slomo) 2011-08-30 15:06:08 UTC
Ok, let's reopen this one then
Comment 12 Sjoerd Simons 2011-09-19 10:52:38 UTC
Created attachment 196920 [details] [review]
videorate: Add more strict caps negotiation

First step, make the caps negotiation more strict
Comment 13 Sjoerd Simons 2011-09-19 10:53:32 UTC
Created attachment 196921 [details] [review]
videorate: Add test for caps negotiation
Comment 14 Sebastian Dröge (slomo) 2011-09-19 11:47:29 UTC
Review of attachment 196920 [details] [review]:

::: gst/videorate/gstvideorate.c
@@ +274,3 @@
+    *max_num = gst_value_get_fraction_numerator (max);
+    *max_denom = gst_value_get_fraction_denominator (max);
+  } else if (GST_VALUE_HOLDS_LIST (v)) {

It could also be a fraction range and quite often is

@@ +327,3 @@
+  s2 = gst_structure_copy (s);
+
+  if (videorate->drop_only) {

You should probably call gst_base_transform_reconfigure() whenever this property changes now
Comment 15 Sjoerd Simons 2011-09-19 18:14:48 UTC
(In reply to comment #14)
> Review of attachment 196920 [details] [review]:
> 
> ::: gst/videorate/gstvideorate.c
> @@ +274,3 @@
> +    *max_num = gst_value_get_fraction_numerator (max);
> +    *max_denom = gst_value_get_fraction_denominator (max);
> +  } else if (GST_VALUE_HOLDS_LIST (v)) {
> 
> It could also be a fraction range and quite often is

The previous case checks for that already or am i missing something?

> @@ +327,3 @@
> +  s2 = gst_structure_copy (s);
> +
> +  if (videorate->drop_only) {
> 
> You should probably call gst_base_transform_reconfigure() whenever this
> property changes now

Done as part of my next patch :)
Comment 16 Sjoerd Simons 2011-09-19 18:16:18 UTC
Created attachment 196985 [details] [review]
Add maxrate property and make caps negotiation more strict

git branch at:
  http://cgit.collabora.com/git/user/sjoerd/gst-plugins-base.git/log/?h=videorate

This patch is a squashed version of the various patches (if someone prefers to have them all individually attached, please let me know)
Comment 17 Sebastian Dröge (slomo) 2011-09-20 12:41:12 UTC
Comment on attachment 196985 [details] [review]
Add maxrate property and make caps negotiation more strict

Looks good and yes, I missed the fraction range branch. sorry :)
Comment 18 Sjoerd Simons 2011-09-21 10:34:02 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.