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 683920 - rmdemux can not set caps on its own pad
rmdemux can not set caps on its own pad
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
0.11.x
Other All
: Normal major
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-13 07:04 UTC by zhangyanping
Modified: 2012-09-14 08:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description zhangyanping 2012-09-13 07:04:53 UTC
In function gst_rmdemux_add_stream,  it will create video and audio pad, and will set caps of them.

static void
gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
{
    if (stream->subtype == GST_RMDEMUX_STREAM_VIDEO) {
        char *name = g_strdup_printf ("video_%u", rmdemux->n_video_streams);

        stream->pad =
            gst_pad_new_from_static_template (&gst_rmdemux_videosrc_template, name);
 ......

    } else if (stream->subtype == GST_RMDEMUX_STREAM_AUDIO) {
        char *name = g_strdup_printf ("audio_%u", rmdemux->n_audio_streams);

        stream->pad =
            gst_pad_new_from_static_template (&gst_rmdemux_audiosrc_template, name);

    }
......
    gst_pad_use_fixed_caps (stream->pad);

    gst_pad_set_caps (stream->pad, stream_caps);
    gst_pad_set_event_function (stream->pad,
.....

}


gst_pad_new_from_static_template --> gst_pad_init will set pad flag to flushing by call GST_PAD_SET_FLUSHING (pad);

And gst_pad_set_caps will failed if the pad flag is flushing.

So we should add GST_PAD_UNSET_FLUSHING(stream->pad) after the pad is created.
Comment 1 Wim Taymans 2012-09-13 10:30:46 UTC
What's the problem? there is a

    gst_pad_set_active (stream->pad, TRUE);

before the events are pushed.
Comment 2 zhangyanping 2012-09-14 01:51:41 UTC
 The code is like this.

//=================
static void
gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
{
    ......
    gst_pad_use_fixed_caps (stream->pad);

    gst_pad_set_caps (stream->pad, stream_caps);
    gst_pad_set_event_function (stream->pad,
        GST_DEBUG_FUNCPTR (gst_rmdemux_src_event));
    gst_pad_set_query_function (stream->pad,
        GST_DEBUG_FUNCPTR (gst_rmdemux_src_query));

    GST_DEBUG_OBJECT (rmdemux, "adding pad %s with caps %" GST_PTR_FORMAT
        ", stream_id=%d", GST_PAD_NAME (stream->pad), stream_caps, stream->id);
    gst_pad_set_active (stream->pad, TRUE);
    gst_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
    ......
}

It pushs the caps event before setting the pad to active. So maybe bring "gst_pad_set_active (stream->pad, TRUE);"  before  "gst_pad_set_caps (stream->pad, stream_caps);".
Comment 3 Tim-Philipp Müller 2012-09-14 07:42:16 UTC
This was fixed ages ago as far as I can tell, it's even included in the 0.11.93 release from August:


commit 1c07373c2bfccef2dd289177e52ceb97003b6d43
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Wed Jul 18 16:46:46 2012 +0100

    rmdemux: set/send caps after activating the source pads
    
    Makes sure the caps event isn't dropped immediately.

diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c
index 28481a4..6fde1f4 100644
--- a/gst/realmedia/rmdemux.c
+++ b/gst/realmedia/rmdemux.c
@@ -1479,7 +1479,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
 
     gst_pad_use_fixed_caps (stream->pad);
 
-    gst_pad_set_caps (stream->pad, stream_caps);
     gst_pad_set_event_function (stream->pad,
         GST_DEBUG_FUNCPTR (gst_rmdemux_src_event));
     gst_pad_set_query_function (stream->pad,
@@ -1488,6 +1487,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
     GST_DEBUG_OBJECT (rmdemux, "adding pad %s with caps %" GST_PTR_FORMAT
         ", stream_id=%d", GST_PAD_NAME (stream->pad), stream_caps, stream->id);
     gst_pad_set_active (stream->pad, TRUE);
+    gst_pad_set_caps (stream->pad, stream_caps);
     gst_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
     gst_pad_push_event (stream->pad, gst_event_new_stream_start ());
Comment 4 zhangyanping 2012-09-14 08:08:14 UTC
(In reply to comment #3)
> This was fixed ages ago as far as I can tell, it's even included in the 0.11.93
> release from August:
> 
> 
> commit 1c07373c2bfccef2dd289177e52ceb97003b6d43
> Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
> Date:   Wed Jul 18 16:46:46 2012 +0100
> 
>     rmdemux: set/send caps after activating the source pads
> 
>     Makes sure the caps event isn't dropped immediately.
> 
> diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c
> index 28481a4..6fde1f4 100644
> --- a/gst/realmedia/rmdemux.c
> +++ b/gst/realmedia/rmdemux.c
> @@ -1479,7 +1479,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux,
> GstRMDemuxStream * stream)
> 
>      gst_pad_use_fixed_caps (stream->pad);
> 
> -    gst_pad_set_caps (stream->pad, stream_caps);
>      gst_pad_set_event_function (stream->pad,
>          GST_DEBUG_FUNCPTR (gst_rmdemux_src_event));
>      gst_pad_set_query_function (stream->pad,
> @@ -1488,6 +1487,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux,
> GstRMDemuxStream * stream)
>      GST_DEBUG_OBJECT (rmdemux, "adding pad %s with caps %" GST_PTR_FORMAT
>          ", stream_id=%d", GST_PAD_NAME (stream->pad), stream_caps,
> stream->id);
>      gst_pad_set_active (stream->pad, TRUE);
> +    gst_pad_set_caps (stream->pad, stream_caps);
>      gst_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
>      gst_pad_push_event (stream->pad, gst_event_new_stream_start ());

OK, thank you Tim. May I ask that when the gstreamer 0.11 stable version will be release ? Or when planing to release ?
Comment 5 Tim-Philipp Müller 2012-09-14 08:20:00 UTC
> OK, thank you Tim. May I ask that when the gstreamer 0.11 stable version will
> be release ? Or when planing to release ?

You can use the 0.11.9x releases. The current release is 0.11.94. Otherwise

http://gstreamer.freedesktop.org/wiki/ReleasePlanning2012

1.0.0 will be the 'stable' release (bu 0.11.94 is already 99.99% stable).