From e47ffb203b29acc7ccc26b19747d6480d78e45cc Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 17 Aug 2013 11:28:13 +0200 Subject: [PATCH] videomixer: Do not send flush_stop ourself after a flush_start When we receive a flush_start, we should wait for the next flush_stop and foward it, not create a flush_stop ourself. --- gst/videomixer/videomixer2.c | 5 +++-- gst/videomixer/videomixer2.h | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c index 9c6398f2bb..1a0662215b 100644 --- a/gst/videomixer/videomixer2.c +++ b/gst/videomixer/videomixer2.c @@ -644,6 +644,7 @@ gst_videomixer2_reset (GstVideoMixer2 * mix) mix->newseg_pending = TRUE; g_atomic_int_set (&mix->flush_stop_pending, FALSE); + g_atomic_int_set (&mix->waiting_flush_stop, FALSE); } /* 1 == OK @@ -1734,13 +1735,13 @@ gst_videomixer2_sink_event (GstCollectPads * pads, GstCollectData * cdata, break; } case GST_EVENT_FLUSH_START: - g_atomic_int_set (&mix->flush_stop_pending, TRUE); + g_atomic_int_set (&mix->waiting_flush_stop, TRUE); ret = gst_collect_pads_event_default (pads, cdata, event, discard); event = NULL; break; case GST_EVENT_FLUSH_STOP: mix->newseg_pending = TRUE; - if (g_atomic_int_compare_and_exchange (&mix->flush_stop_pending, TRUE, + if (g_atomic_int_compare_and_exchange (&mix->waiting_flush_stop, TRUE, FALSE)) { GST_DEBUG_OBJECT (pad, "forwarding flush stop"); ret = gst_collect_pads_event_default (pads, cdata, event, discard); diff --git a/gst/videomixer/videomixer2.h b/gst/videomixer/videomixer2.h index b853256145..4a0b744eb9 100644 --- a/gst/videomixer/videomixer2.h +++ b/gst/videomixer/videomixer2.h @@ -97,7 +97,11 @@ struct _GstVideoMixer2 gboolean send_caps; gboolean newseg_pending; - gboolean flush_stop_pending; + gboolean flush_stop_pending; /* Used when we receive a flushing seek, + to send a flush_stop right before the + following buffer */ + gboolean waiting_flush_stop; /* Used when we receive a flush_start to make + sure to forward the flush_stop only once */ GstVideoMixer2Background background;