summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOgnyan Tonchev <ognyan@axis.com>2015-06-11 17:39:00 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-06-16 11:09:37 +0200
commitfb71b9c4e9bb66784491df81537d4865b99480f1 (patch)
treee466fcb4b4ebbd443f13cfaaa989bd2e3bb5a765
parentfdfe97f447282c3ad9c1004516926173ba4a525d (diff)
rtsp-media: Always use real payloader when creating streams
A bin that contains the real payloader might be used as payloader. In this case we have to get the real payloader for the various properties it provides. Example use cases for this are bins that payload some media and then have additional elements that add metadata or RTP extension headers to the stream. https://bugzilla.gnome.org/show_bug.cgi?id=750800
-rw-r--r--gst/rtsp-server/rtsp-media.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
index d4efd5f..53b2cc4 100644
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -211,6 +211,8 @@ static gboolean default_handle_sdp (GstRTSPMedia * media, GstSDPMessage * sdp);
static gboolean wait_preroll (GstRTSPMedia * media);
+static GstElement * find_payload_element (GstElement * payloader);
+
static guint gst_rtsp_media_signals[SIGNAL_LAST] = { 0 };
#define C_ENUM(v) ((gint) v)
@@ -1442,12 +1444,24 @@ gst_rtsp_media_collect_streams (GstRTSPMedia * media)
name = g_strdup_printf ("pay%d", i);
if ((elem = gst_bin_get_by_name (GST_BIN (element), name))) {
+ GstElement *pay;
GST_INFO ("found stream %d with payloader %p", i, elem);
/* take the pad of the payloader */
pad = gst_element_get_static_pad (elem, "src");
+
+ /* find the real payload element in case elem is a GstBin */
+ pay = find_payload_element (elem);
+
/* create the stream */
- gst_rtsp_media_create_stream (media, elem, pad);
+ if (pay == NULL) {
+ GST_WARNING ("could not find real payloader, using bin");
+ gst_rtsp_media_create_stream (media, elem, pad);
+ } else {
+ gst_rtsp_media_create_stream (media, pay, pad);
+ gst_object_unref (pay);
+ }
+
gst_object_unref (pad);
gst_object_unref (elem);