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
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index f3f95e6..f6e1993 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -772,7 +772,7 @@
     }
 
     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;
@@ -823,7 +823,13 @@
           "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;