playbin2: forward duration query duration during group switch if no cached duration
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Fri, 30 Apr 2010 11:36:59 +0000 (13:36 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Fri, 30 Apr 2010 11:36:59 +0000 (13:36 +0200)
... such as during first group setup.

Fixes #616396.

gst/playback/gstplaybin2.c

index 3b34fcb..44629b9 100644 (file)
@@ -2072,11 +2072,15 @@ gst_play_bin_query (GstElement * element, GstQuery * query)
           break;
         }
       }
-      GST_DEBUG_OBJECT (playbin,
-          "Taking cached duration because of pending group switch: %d", ret);
-      GST_SOURCE_GROUP_UNLOCK (group);
-      GST_PLAY_BIN_UNLOCK (playbin);
-      return ret;
+      /* if nothing cached yet, we might as well request duration,
+       * such as during initial startup */
+      if (ret) {
+        GST_DEBUG_OBJECT (playbin,
+            "Taking cached duration because of pending group switch: %d", ret);
+        GST_SOURCE_GROUP_UNLOCK (group);
+        GST_PLAY_BIN_UNLOCK (playbin);
+        return ret;
+      }
     }
     GST_SOURCE_GROUP_UNLOCK (group);
   }