From: Song Bing <bing.song@nxp.com>
Date: Wed, 11 May 2016 16:57:23 +0800
Subject: [PATCH] inputselector: should proceed non-active pad buffer even if
 active pad reach eos

non-active pad will be blocked if active pad reach eos in inputselector.
Which will cause all pipeline be blocked.
Inputselector should proceed non-active pad buffer based on clock even
if active pad reach eos
Change to sync with clock for better user experience.

https://bugzilla.gnome.org/show_bug.cgi?id=766261

Upstream status: pending

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

diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index 4af219047e09..441a4e40abba 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -763,7 +763,7 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
     }
 
     cur_running_time = GST_CLOCK_TIME_NONE;
-    if (sel->sync_mode == GST_INPUT_SELECTOR_SYNC_MODE_CLOCK) {
+    if (sel->sync_mode == GST_INPUT_SELECTOR_SYNC_MODE_CLOCK || active_selpad->eos) {
       clock = gst_element_get_clock (GST_ELEMENT_CAST (sel));
       if (clock) {
         GstClockTime base_time;
@@ -805,7 +805,13 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
           "Waiting for active streams to advance. %" GST_TIME_FORMAT " >= %"
           GST_TIME_FORMAT, GST_TIME_ARGS (running_time),
           GST_TIME_ARGS (cur_running_time));
-      GST_INPUT_SELECTOR_WAIT (sel);
+      if (active_selpad->eos) {
+        GST_INPUT_SELECTOR_UNLOCK (sel);
+        g_usleep (5000);
+        GST_INPUT_SELECTOR_LOCK (sel);
+      } else {
+        GST_INPUT_SELECTOR_WAIT (sel);
+      }
     } else {
       GST_INPUT_SELECTOR_UNLOCK (sel);
       break;
