summaryrefslogtreecommitdiff
path: root/recipes-multimedia/gstreamer/gstreamer1.0/0007-inputselector-Need-flush-when-set-active-pad-and-the.patch
blob: c5d329b6524df379d1067e1955fdb48b3d89430d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 9860e95c4c6bcec422b6c83a2650ef76dd6a5488 Mon Sep 17 00:00:00 2001
From: Song Bing <bing.song@nxp.com>
Date: Wed, 10 May 2017 11:24:46 +0800
Subject: [PATCH 7/7] inputselector: Need flush when set active pad and then
 seek in PAUSE state


Upstream-Status: Pending [https://bugzilla.gnome.org/show_bug.cgi?id=782417]

Signed-off-by: Song Bing bing.song@nxp.com
---
 plugins/elements/gstinputselector.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index f6e1993..54400dd 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -161,6 +161,7 @@ struct _GstSelectorPad
   guint32 segment_seqnum;       /* sequence number of the current segment */
 
   gboolean events_pending;      /* TRUE if sticky events need to be updated */
+  gboolean flush_events_pending;/* unblock old active track */
 
   gboolean sending_cached_buffers;
   GQueue *cached_buffers;
@@ -339,6 +340,7 @@ gst_selector_pad_reset (GstSelectorPad * pad)
   pad->eos = FALSE;
   pad->eos_sent = FALSE;
   pad->events_pending = FALSE;
+  pad->flush_events_pending = FALSE;
   pad->discont = FALSE;
   pad->flushing = FALSE;
   gst_segment_init (&pad->segment, GST_FORMAT_UNDEFINED);
@@ -557,6 +559,8 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
       selpad->flushing = TRUE;
       sel->eos = FALSE;
       selpad->group_done = FALSE;
+      if (selpad->flush_events_pending)
+        forward = TRUE;
       GST_INPUT_SELECTOR_BROADCAST (sel);
       break;
     case GST_EVENT_FLUSH_STOP:
@@ -1136,6 +1140,7 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     buf = gst_buffer_ref (buf);
   res = gst_pad_push (sel->srcpad, buf);
   GST_LOG_OBJECT (pad, "Buffer %p forwarded result=%d", buf, res);
+  selpad->flush_events_pending = FALSE;
 
   GST_INPUT_SELECTOR_LOCK (sel);
 
@@ -1389,8 +1394,12 @@ gst_input_selector_set_active_pad (GstInputSelector * self, GstPad * pad)
   active_pad_p = &self->active_sinkpad;
   gst_object_replace ((GstObject **) active_pad_p, GST_OBJECT_CAST (pad));
 
-  if (old && old != new)
+  if (old && old != new) {
     gst_pad_push_event (GST_PAD_CAST (old), gst_event_new_reconfigure ());
+    /* Old will be blocked on gst_pad_push() when set active pad in PAUSE
+     * state. Need flush when set active pad and then seek in PAUSE state */
+    old->flush_events_pending = TRUE;
+  }
   if (new)
     gst_pad_push_event (GST_PAD_CAST (new), gst_event_new_reconfigure ());
 
-- 
1.9.1