mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
clocksync: Remove handoff signals
They're not really useful on this element and were just a leftover from identity. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/540 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/443>
This commit is contained in:
parent
c09f797231
commit
687c65994e
3 changed files with 3 additions and 120 deletions
|
@ -52,25 +52,15 @@
|
|||
GST_DEBUG_CATEGORY_STATIC (gst_clock_sync_debug);
|
||||
#define GST_CAT_DEFAULT gst_clock_sync_debug
|
||||
|
||||
/* ClockSync signals and args */
|
||||
enum
|
||||
{
|
||||
SIGNAL_HANDOFF,
|
||||
SIGNAL_HANDOFF_LIST,
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
/* ClockSync args */
|
||||
#define DEFAULT_SYNC TRUE
|
||||
#define DEFAULT_TS_OFFSET 0
|
||||
#define DEFAULT_SIGNAL_HANDOFFS FALSE
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_SYNC,
|
||||
PROP_TS_OFFSET,
|
||||
PROP_SIGNAL_HANDOFFS,
|
||||
PROP_TS_OFFSET
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
|
@ -109,8 +99,6 @@ static gboolean gst_clock_sync_src_query (GstPad * pad, GstObject * parent,
|
|||
static GstStateChangeReturn gst_clocksync_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
static guint gst_clocksync_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void
|
||||
gst_clock_sync_class_init (GstClockSyncClass * klass)
|
||||
{
|
||||
|
@ -133,43 +121,6 @@ gst_clock_sync_class_init (GstClockSyncClass * klass)
|
|||
"Timestamp offset in nanoseconds for synchronisation, negative for earlier sync",
|
||||
G_MININT64, G_MAXINT64, DEFAULT_TS_OFFSET,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GstClockSync::signal-handoffs
|
||||
*
|
||||
* If set to %TRUE, the clocksync will emit a handoff signal when handling a buffer.
|
||||
* When set to %FALSE, no signal will be emitted, which might improve performance.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_SIGNAL_HANDOFFS,
|
||||
g_param_spec_boolean ("signal-handoffs",
|
||||
"Signal handoffs", "Send a signal before pushing the buffer",
|
||||
DEFAULT_SIGNAL_HANDOFFS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GstClockSync::handoff:
|
||||
* @clocksync: the clocksync instance
|
||||
* @buffer: the buffer that just has been received
|
||||
* @pad: the pad that received it
|
||||
*
|
||||
* This signal gets emitted before passing the buffer downstream.
|
||||
*/
|
||||
gst_clocksync_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstClockSyncClass, handoff), NULL, NULL,
|
||||
NULL, G_TYPE_NONE, 1, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
/**
|
||||
* GstClockSync::handoff-list:
|
||||
* @clocksync: the clocksync instance
|
||||
* @buffer_list: the buffer list that just has been received
|
||||
* @pad: the pad that received it
|
||||
*
|
||||
* This signal gets emitted before passing the buffer list downstream.
|
||||
*/
|
||||
gst_clocksync_signals[SIGNAL_HANDOFF_LIST] =
|
||||
g_signal_new ("handoff-list", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstClockSyncClass, handoff_list),
|
||||
NULL, NULL, NULL, G_TYPE_NONE, 1,
|
||||
GST_TYPE_BUFFER_LIST | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
gstelement_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_clocksync_change_state);
|
||||
|
@ -213,7 +164,6 @@ gst_clock_sync_init (GstClockSync * clocksync)
|
|||
GST_PAD_SET_PROXY_CAPS (clocksync->srcpad);
|
||||
gst_element_add_pad (GST_ELEMENT (clocksync), clocksync->srcpad);
|
||||
|
||||
clocksync->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
|
||||
clocksync->ts_offset = DEFAULT_TS_OFFSET;
|
||||
clocksync->sync = DEFAULT_SYNC;
|
||||
g_cond_init (&clocksync->blocked_cond);
|
||||
|
@ -232,9 +182,6 @@ gst_clock_sync_set_property (GObject * object, guint prop_id,
|
|||
case PROP_TS_OFFSET:
|
||||
clocksync->ts_offset = g_value_get_int64 (value);
|
||||
break;
|
||||
case PROP_SIGNAL_HANDOFFS:
|
||||
clocksync->signal_handoffs = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -254,9 +201,6 @@ gst_clock_sync_get_property (GObject * object, guint prop_id,
|
|||
case PROP_TS_OFFSET:
|
||||
g_value_set_int64 (value, clocksync->ts_offset);
|
||||
break;
|
||||
case PROP_SIGNAL_HANDOFFS:
|
||||
g_value_set_boolean (value, clocksync->signal_handoffs);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -413,9 +357,6 @@ gst_clock_sync_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
|||
}
|
||||
}
|
||||
|
||||
if (clocksync->signal_handoffs)
|
||||
g_signal_emit (clocksync, gst_clocksync_signals[SIGNAL_HANDOFF], 0, buf);
|
||||
|
||||
/* Forward the buffer */
|
||||
return gst_pad_push (clocksync->srcpad, buf);
|
||||
}
|
||||
|
@ -457,10 +398,6 @@ gst_clock_sync_chain_list (GstPad * pad, GstObject * parent,
|
|||
}
|
||||
}
|
||||
|
||||
if (clocksync->signal_handoffs)
|
||||
g_signal_emit (clocksync, gst_clocksync_signals[SIGNAL_HANDOFF_LIST], 0,
|
||||
buffer_list);
|
||||
|
||||
/* Forward the buffer list */
|
||||
done:
|
||||
return gst_pad_push_list (clocksync->srcpad, buffer_list);
|
||||
|
|
|
@ -51,8 +51,6 @@ struct _GstClockSync
|
|||
/*< private >*/
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
gboolean signal_handoffs;
|
||||
|
||||
GstSegment segment;
|
||||
GstClockID clock_id;
|
||||
gboolean flushing;
|
||||
|
@ -68,10 +66,6 @@ struct _GstClockSync
|
|||
struct _GstClockSyncClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*handoff) (GstElement *element, GstBuffer *buf);
|
||||
void (*handoff_list) (GstElement *element, GstBufferList *buffer_list);
|
||||
};
|
||||
|
||||
GType gst_clock_sync_get_type (void);
|
||||
|
|
|
@ -58,53 +58,6 @@ GST_START_TEST (test_one_buffer)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
static void
|
||||
handoff_func (GstElement * clocksync, GstBuffer * buf, GstBuffer ** ret)
|
||||
{
|
||||
(void) clocksync;
|
||||
*ret = buf;
|
||||
}
|
||||
|
||||
GST_START_TEST (test_signal_handoffs)
|
||||
{
|
||||
GstHarness *h = gst_harness_new_parse ("clocksync sync=false name=c");
|
||||
GstBuffer *buffer_in;
|
||||
GstBuffer *buffer_signaled = NULL;
|
||||
GstElement *c = gst_bin_get_by_name (GST_BIN (h->element), "c");
|
||||
|
||||
gst_harness_set_src_caps_str (h, "mycaps");
|
||||
|
||||
/* connect to the handoff signal */
|
||||
g_signal_connect (c, "handoff", G_CALLBACK (handoff_func), &buffer_signaled);
|
||||
|
||||
/* first, turn off signal-handoffs */
|
||||
g_object_set (c, "signal-handoffs", FALSE, NULL);
|
||||
|
||||
/* then push a buffer */
|
||||
buffer_in = gst_buffer_new_and_alloc (4);
|
||||
fail_unless_equals_int (GST_FLOW_OK, gst_harness_push (h, buffer_in));
|
||||
|
||||
/* verify that we got no buffer signaled */
|
||||
fail_unless (buffer_signaled == NULL);
|
||||
|
||||
/* now turn on signal-handoffs */
|
||||
g_object_set (c, "signal-handoffs", TRUE, NULL);
|
||||
|
||||
/* then push another buffer */
|
||||
buffer_in = gst_buffer_new_and_alloc (4);
|
||||
fail_unless_equals_int (GST_FLOW_OK, gst_harness_push (h, buffer_in));
|
||||
|
||||
/* verify the buffer signaled is equal to the one pushed in */
|
||||
fail_unless (buffer_signaled == buffer_in);
|
||||
ASSERT_BUFFER_REFCOUNT (buffer_signaled, "buffer", 1);
|
||||
|
||||
/* cleanup */
|
||||
gst_object_unref (c);
|
||||
gst_harness_teardown (h);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_sync_on_timestamp)
|
||||
{
|
||||
/* the reason to use the queue in front of the clocksync element
|
||||
|
@ -223,7 +176,6 @@ clocksync_suite (void)
|
|||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_one_buffer);
|
||||
tcase_add_test (tc_chain, test_signal_handoffs);
|
||||
tcase_add_test (tc_chain, test_sync_on_timestamp);
|
||||
tcase_add_test (tc_chain, test_stopping_element_unschedules_sync);
|
||||
tcase_add_test (tc_chain, test_no_sync_on_timestamp);
|
||||
|
|
Loading…
Reference in a new issue