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 647648 - videorate: support for caps modifications in a running pipeline
videorate: support for caps modifications in a running pipeline
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.32
Other Linux
: Normal enhancement
: 0.10.36
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-04-13 12:50 UTC by Nicola
Modified: 2011-09-26 09:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test app that show the problem (3.75 KB, application/zip)
2011-06-30 18:29 UTC, Nicola
Details

Description Nicola 2011-04-13 12:50:09 UTC
videorate element doesn't support framerate modification in a running pipeline

for example in a pipeline such this:

... ! videorate ! capsfilter name=vfps ! ..

GstCaps *new_caps=gst_caps_from_string("video/x-raw-yuv,framerate=15/1");
g_object_set(G_OBJECT (vfps),"caps",new_caps,NULL);
gst_caps_unref(new_caps);

doesn't work if the pipeline is in PLAYING state. Other elements such as videoscale support dynamic modifications.
Comment 1 David Schleef 2011-06-30 07:26:45 UTC
Could you create a simple test case for this, preferably as a patch to tests/check/elements/videorate.c?
Comment 2 Nicola 2011-06-30 12:16:55 UTC
David, I can do a qt application that can demonstrate the issue quickly, is this good enough?
Comment 3 David Schleef 2011-06-30 16:47:35 UTC
No, i meant something that could go into the test suite.
Comment 4 Nicola 2011-06-30 18:29:26 UTC
Created attachment 191051 [details]
test app that show the problem

Attached is a sample application, David I know this is not enough for you, I hope some other developer can play with it and mark this bug as confirmed. The app assume you have a v4l2src device and the fpsdisplay sink element. It start this pipeline:

v4l2src ! videorate ! capsfilter name=vfps caps="video/xraw-yuv,framerate=2/1" ! fpsdisplaysink

when the pipeline go to play state start a timer that after 10 seconds change the capsfilter with the following code:

    GstElement *vfps=gst_bin_get_by_name(GST_BIN(pipe),"vfps");
    GstCaps *new_caps; //=gst_caps_from_string("video/x-raw-yuv,framerate=15/1");
    new_caps = gst_caps_new_simple("video/x-raw-yuv",
                               "framerate",GST_TYPE_FRACTION, 15, 1,
                               NULL);
    g_object_set(G_OBJECT (vfps),"caps",new_caps,NULL);
    gst_caps_unref(new_caps);
    gst_object_unref(vfps);

well, fpsdisplaysink will continue to show 2fps even after this change,

to compile the app use qmake && make
Comment 5 Tom 2011-07-09 23:11:52 UTC
Yes I have the same problem!
the framerate is always 2 even after the timer running for 10 seconds.
PS: I am using the code uploaded by Nicola.


(In reply to comment #4)
> Created an attachment (id=191051) [details]
> test app that show the problem
> 
> Attached is a sample application, David I know this is not enough for you, I
> hope some other developer can play with it and mark this bug as confirmed. The
> app assume you have a v4l2src device and the fpsdisplay sink element. It start
> this pipeline:
> 
> v4l2src ! videorate ! capsfilter name=vfps caps="video/xraw-yuv,framerate=2/1"
> ! fpsdisplaysink
> 
> when the pipeline go to play state start a timer that after 10 seconds change
> the capsfilter with the following code:
> 
>     GstElement *vfps=gst_bin_get_by_name(GST_BIN(pipe),"vfps");
>     GstCaps *new_caps;
> //=gst_caps_from_string("video/x-raw-yuv,framerate=15/1");
>     new_caps = gst_caps_new_simple("video/x-raw-yuv",
>                                "framerate",GST_TYPE_FRACTION, 15, 1,
>                                NULL);
>     g_object_set(G_OBJECT (vfps),"caps",new_caps,NULL);
>     gst_caps_unref(new_caps);
>     gst_object_unref(vfps);
> 
> well, fpsdisplaysink will continue to show 2fps even after this change,
> 
> to compile the app use qmake && make
Comment 6 Nicola 2011-07-10 15:35:54 UTC
changing the state to NULL for videorate element before the caps change and then set it to play again, make my sample works, not sure if this is the correct behaviour, for example for the videoscale element a caps change to the framesize works without requiring to set the element to NULL and then to PLAY
Comment 7 Sebastian Dröge (slomo) 2011-07-10 17:40:30 UTC
No, the element should handle caps changes while staying in the PLAYING state.
Comment 8 Tom 2011-07-10 20:59:56 UTC
(In reply to comment #7)
> No, the element should handle caps changes while staying in the PLAYING state.

How? Could you please give me some instruction of how to change framerate while staying in the PLAYING state?

Thanks!
Comment 9 Nicola 2011-07-10 22:24:59 UTC
Hi Tom, 

here is how:

GstElement *vrate=gst_bin_get_by_name(GST_BIN(pipe),"vrate");
gst_element_set_state(vrate,GST_STATE_NULL);
g_object_set(G_OBJECT (vfps),"caps",new_caps,NULL);
gst_element_set_state(vrate,GST_STATE_PLAYING);

however according to Sebastian comment, this should be handled by videorate internally,

Nicola
Comment 10 Olivier Crête 2011-07-11 19:29:10 UTC
Arg, videorate isn't basetransform based. So it's normal that it doesn't work.. We should just rebase it over BaseTransform and we'd get most of it for free.
Comment 11 Nicola 2011-09-25 08:38:24 UTC
Not tested but maybe this commit could fix this issue:

http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=b9b5b133fd911d048295d959e0bb7fda72347469
Comment 12 Sebastian Dröge (slomo) 2011-09-26 09:38:13 UTC
No but this one should've fixed it:
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=ea46b3c706ea99257d2b31cb5c7fb281f43b3178

Please reopen otherwise