summaryrefslogtreecommitdiff
path: root/gst/audiolatency/gstaudiolatency.c
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2021-05-20 15:39:39 +0900
committerSeungha Yang <seungha@centricular.com>2021-05-20 15:50:55 +0900
commit1f743c8d843e6f9b4f871f298cd86fc7e06a507e (patch)
treebfdca771f3e5fa22d0560f417daea54a77474c52 /gst/audiolatency/gstaudiolatency.c
parent3bd600741c425000ab0ea8ba650ee1e93ad3a7a7 (diff)
downloadgstreamer-plugins-bad-1f743c8d843e6f9b4f871f298cd86fc7e06a507e.tar.gz
audiolatency: Drop incoming downstream stick events
stream-start, caps, and segment events will be pushed by internal audiotestsrc element. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2265>
Diffstat (limited to 'gst/audiolatency/gstaudiolatency.c')
-rw-r--r--gst/audiolatency/gstaudiolatency.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gst/audiolatency/gstaudiolatency.c b/gst/audiolatency/gstaudiolatency.c
index 80d002694..e4b6fe0c1 100644
--- a/gst/audiolatency/gstaudiolatency.c
+++ b/gst/audiolatency/gstaudiolatency.c
@@ -98,6 +98,8 @@ static gint64 gst_audiolatency_get_latency (GstAudioLatency * self);
static gint64 gst_audiolatency_get_average_latency (GstAudioLatency * self);
static GstFlowReturn gst_audiolatency_sink_chain (GstPad * pad,
GstObject * parent, GstBuffer * buffer);
+static gboolean gst_audiolatency_sink_event (GstPad * pad,
+ GstObject * parent, GstEvent * event);
static GstPadProbeReturn gst_audiolatency_src_probe (GstPad * pad,
GstPadProbeInfo * info, gpointer user_data);
@@ -186,6 +188,9 @@ gst_audiolatency_init (GstAudioLatency * self)
self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
gst_pad_set_chain_function (self->sinkpad,
GST_DEBUG_FUNCPTR (gst_audiolatency_sink_chain));
+ gst_pad_set_event_function (self->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_audiolatency_sink_event));
+
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
/* Setup srcpad */
@@ -423,6 +428,23 @@ out:
return GST_FLOW_OK;
}
+static gboolean
+gst_audiolatency_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
+{
+ switch (GST_EVENT_TYPE (event)) {
+ /* Drop below events. audiotestsrc will push its own event */
+ case GST_EVENT_STREAM_START:
+ case GST_EVENT_CAPS:
+ case GST_EVENT_SEGMENT:
+ gst_event_unref (event);
+ return TRUE;
+ default:
+ break;
+ }
+
+ return gst_pad_event_default (pad, parent, event);
+}
+
/* Element registration */
static gboolean
plugin_init (GstPlugin * plugin)