summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2016-01-13 09:51:20 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2016-01-15 11:32:37 -0300
commitb7a0be23c6865286674ecac127bc4a1603437ee9 (patch)
treeecf30c64a1d893265af3a899c2d7c8ea83d78bf9 /tests
parentd92f11b8196cf731881204a473f0dafd39df87c9 (diff)
downloadgstreamer-plugins-bad-b7a0be23c6865286674ecac127bc4a1603437ee9.tar.gz
adaptivedemux: replace ghostpad with a standard pad
Handling the ghostpad and its internal pad was causing more issues than helping because of their coupled activation/deactivation actions. As we have to install custom chain,event and query functions it is better to use a floating sink pad internally in the demuxer and just use those pad functions to push through a standard pad in the demuxer https://bugzilla.gnome.org/show_bug.cgi?id=757951
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/adaptive_demux_common.c2
-rw-r--r--tests/check/elements/adaptive_demux_engine.c53
-rw-r--r--tests/check/elements/adaptive_demux_engine.h1
3 files changed, 43 insertions, 13 deletions
diff --git a/tests/check/elements/adaptive_demux_common.c b/tests/check/elements/adaptive_demux_common.c
index e5a95e493..44fd05035 100644
--- a/tests/check/elements/adaptive_demux_common.c
+++ b/tests/check/elements/adaptive_demux_common.c
@@ -403,7 +403,7 @@ testSeekOnStateChanged (GstBus * bus, GstMessage * msg, gpointer user_data)
gst_element_state_get_name (old_state),
gst_element_state_get_name (new_state));
- if (strstr (srcName, "bin") == srcName &&
+ if (strstr (srcName, "srcbin") == srcName &&
old_state == GST_STATE_PLAYING && new_state == GST_STATE_PAUSED) {
g_mutex_lock (&testData->test_task_state_lock);
if (testData->test_task_state ==
diff --git a/tests/check/elements/adaptive_demux_engine.c b/tests/check/elements/adaptive_demux_engine.c
index 880d259b1..34ea252f4 100644
--- a/tests/check/elements/adaptive_demux_engine.c
+++ b/tests/check/elements/adaptive_demux_engine.c
@@ -1,4 +1,4 @@
-/* A generic test engine for elements based upon GstAdaptiveDemux
+/* A generic test engine for elements based upon GstAdaptiveDemux
*
* Copyright (c) <2015> YouView TV Ltd
*
@@ -227,6 +227,43 @@ on_demuxReceivesEvent (GstPad * pad, GstPadProbeInfo * info, gpointer data)
return GST_PAD_PROBE_OK;
}
+
+static void
+on_demuxElementAdded (GstBin * demux, GstElement * element, gpointer user_data)
+{
+ GstAdaptiveDemuxTestEnginePrivate *priv =
+ (GstAdaptiveDemuxTestEnginePrivate *) user_data;
+ GstAdaptiveDemuxTestOutputStream *stream = NULL;
+ GstPad *internal_pad;
+ gchar *srcbin_name;
+ gint i;
+
+ srcbin_name = GST_ELEMENT_NAME (element);
+ GST_TEST_LOCK (priv);
+ for (i = 0; i < priv->engine.output_streams->len; i++) {
+ stream = g_ptr_array_index (priv->engine.output_streams, i);
+ if (strstr (srcbin_name, GST_PAD_NAME (stream->pad)) != NULL)
+ break;
+ }
+ fail_unless (stream != NULL);
+
+ /* keep the reference to the internal_pad.
+ * We will need it to identify the stream in the on_demuxReceivesEvent callback
+ */
+ if (stream->internal_pad) {
+ gst_pad_remove_probe (stream->internal_pad, stream->internal_pad_probe);
+ gst_object_unref (stream->internal_pad);
+ }
+ internal_pad = gst_element_get_static_pad (element, "src");
+ stream->internal_pad_probe =
+ gst_pad_add_probe (internal_pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
+ (GstPadProbeCallback) on_demuxReceivesEvent, priv, NULL);
+ stream->internal_pad = internal_pad;
+ GST_TEST_UNLOCK (priv);
+
+}
+
+
/* callback called when demux creates a src pad.
* We will create an AppSink to get the data
*/
@@ -239,7 +276,7 @@ on_demuxNewPad (GstElement * demux, GstPad * pad, gpointer user_data)
GstElement *sink;
gboolean ret;
gchar *name;
- GstPad *internal_pad, *appsink_pad;
+ GstPad *appsink_pad;
GstAppSinkCallbacks appSinkCallbacks;
GstAdaptiveDemuxTestOutputStream *stream;
GObjectClass *gobject_class;
@@ -272,7 +309,6 @@ on_demuxNewPad (GstElement * demux, GstPad * pad, gpointer user_data)
(GstPadProbeCallback) on_appsink_event, priv, NULL);
gst_object_unref (appsink_pad);
-
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
(GstPadProbeCallback) on_demux_sent_data, priv, NULL);
gobject_class = G_OBJECT_GET_CLASS (sink);
@@ -281,16 +317,7 @@ on_demuxNewPad (GstElement * demux, GstPad * pad, gpointer user_data)
g_object_set (G_OBJECT (sink), "sync", FALSE, NULL);
}
stream->pad = gst_object_ref (pad);
- internal_pad =
- GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (pad)));
- gst_pad_add_probe (internal_pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
- (GstPadProbeCallback) on_demuxReceivesEvent, priv, NULL);
-
- /* keep the reference to the internal_pad.
- * We will need it to identify the stream in the on_demuxReceivesEvent callback
- */
- stream->internal_pad = internal_pad;
g_ptr_array_add (priv->engine.output_streams, stream);
GST_TEST_UNLOCK (priv);
@@ -439,6 +466,8 @@ gst_adaptive_demux_test_run (const gchar * element_name,
priv->engine.demux = demux;
GST_DEBUG ("created demux %" GST_PTR_FORMAT, demux);
+ g_signal_connect (demux, "element-added", G_CALLBACK (on_demuxElementAdded),
+ priv);
g_signal_connect (demux, "pad-added", G_CALLBACK (on_demuxNewPad), priv);
g_signal_connect (demux, "pad-removed",
G_CALLBACK (on_demuxPadRemoved), priv);
diff --git a/tests/check/elements/adaptive_demux_engine.h b/tests/check/elements/adaptive_demux_engine.h
index 8231c56e7..e23205121 100644
--- a/tests/check/elements/adaptive_demux_engine.h
+++ b/tests/check/elements/adaptive_demux_engine.h
@@ -35,6 +35,7 @@ typedef struct _GstAdaptiveDemuxTestOutputStream {
GstPad *pad;
/* the internal pad of adaptivedemux element used to send data to the GstAppSink element */
GstPad *internal_pad;
+ gulong internal_pad_probe;
/* current segment start offset */
guint64 segment_start;
/* the size received so far on this segment */