player: notify of media-info update after duration change
authorPhilippe Normand <philn@igalia.com>
Mon, 14 Aug 2017 13:09:33 +0000 (14:09 +0100)
committerPhilippe Normand <philn@igalia.com>
Tue, 15 Aug 2017 08:38:55 +0000 (09:38 +0100)
This is a follow-up of 98b0802a981eab05e610638bf5422a08a378a68a

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

gst-libs/gst/player/gstplayer.c

index f061a8b6fa8badc53daa1d17f5e6d8b3c9d2d372..360323e43e73fc80bde6a6f14b692c9a678b3f7d 100644 (file)
@@ -1503,6 +1503,10 @@ duration_changed_signal_data_free (DurationChangedSignalData * data)
 static void
 emit_duration_changed (GstPlayer * self, GstClockTime duration)
 {
+  gboolean updated = FALSE;
+
+  g_return_if_fail (self->cached_duration != duration);
+
   GST_DEBUG_OBJECT (self, "Duration changed %" GST_TIME_FORMAT,
       GST_TIME_ARGS (duration));
 
@@ -1510,8 +1514,12 @@ emit_duration_changed (GstPlayer * self, GstClockTime duration)
   g_mutex_lock (&self->lock);
   if (self->media_info) {
     self->media_info->duration = duration;
+    updated = TRUE;
   }
   g_mutex_unlock (&self->lock);
+  if (updated) {
+    emit_media_info_updated_signal (self);
+  }
 
   if (g_signal_handler_find (self, G_SIGNAL_MATCH_ID,
           signals[SIGNAL_DURATION_CHANGED], 0, NULL, NULL, NULL) != 0) {