player: Only report the initial duration if the query was successful
authorSebastian Dröge <sebastian@centricular.com>
Mon, 26 Sep 2016 10:26:36 +0000 (13:26 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 26 Sep 2016 10:26:36 +0000 (13:26 +0300)
gst-libs/gst/player/gstplayer.c

index fd433bf..62cd800 100644 (file)
@@ -1590,8 +1590,10 @@ state_changed_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg,
       }
 
       check_video_dimensions_changed (self);
-      gst_element_query_duration (self->playbin, GST_FORMAT_TIME, &duration);
-      emit_duration_changed (self, duration);
+      if (gst_element_query_duration (self->playbin, GST_FORMAT_TIME,
+              &duration)) {
+        emit_duration_changed (self, duration);
+      }
     }
 
     if (new_state == GST_STATE_PAUSED