From: Sebastian Dröge Date: Mon, 25 May 2020 11:56:10 +0000 (+0300) Subject: systemclock: Only try initializing entries if they were not initialized before X-Git-Tag: 1.19.3~848 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf0672f00b896dc730fc6f921c1860e59e33ddb4;p=platform%2Fupstream%2Fgstreamer.git systemclock: Only try initializing entries if they were not initialized before And add assertions accordingly. Part-of: --- diff --git a/gst/gstsystemclock.c b/gst/gstsystemclock.c index 0c40607..91e4078 100644 --- a/gst/gstsystemclock.c +++ b/gst/gstsystemclock.c @@ -330,6 +330,7 @@ init_entry (GstClockEntryImpl * entry) G_STATIC_ASSERT (sizeof (GstClockEntryImpl) <= sizeof (struct _GstClockEntryImpl)); +/* Must be called with clock lock */ static inline void ensure_entry_initialized (GstClockEntryImpl * entry_impl) { @@ -488,7 +489,6 @@ gst_system_clock_dispose (GObject * object) /* We don't need to take the entry lock here because the async thread * would only ever look at the head entry, which is locked below and only * accesses new entries with the clock lock, which we hold here. - * This makes it unnecessary to initialize mutex/conds for all entries. */ GST_CLOCK_ENTRY_STATUS ((GstClockEntry *) entry) = GST_CLOCK_UNSCHEDULED; @@ -499,7 +499,9 @@ gst_system_clock_dispose (GObject * object) * entries are unscheduled, would remove them one by one from the list and * then shut down. */ if (!entries->prev) { - ensure_entry_initialized (entry); + /* it was initialized before adding to the list */ + g_assert (entry->initialized); + GST_SYSTEM_CLOCK_ENTRY_LOCK (entry); GST_CAT_DEBUG_OBJECT (GST_CAT_CLOCK, clock, "unscheduling entry %p", entry); @@ -687,7 +689,8 @@ gst_system_clock_async_thread (GstClock * clock) /* pick the next entry */ entry = priv->entries->data; - ensure_entry_initialized ((GstClockEntryImpl *) entry); + /* it was initialized before adding to the list */ + g_assert (((GstClockEntryImpl *) entry)->initialized); /* unlocked before the next loop iteration at latest */ GST_SYSTEM_CLOCK_ENTRY_LOCK ((GstClockEntryImpl *) entry); @@ -1170,7 +1173,9 @@ gst_system_clock_id_wait_async (GstClock * clock, GstClockEntry * entry) } else { GstClockReturn status; - ensure_entry_initialized ((GstClockEntryImpl *) head); + /* it was initialized before adding to the list */ + g_assert (((GstClockEntryImpl *) head)->initialized); + GST_SYSTEM_CLOCK_ENTRY_LOCK ((GstClockEntryImpl *) head); status = GST_CLOCK_ENTRY_STATUS (head); GST_CAT_DEBUG_OBJECT (GST_CAT_CLOCK, clock, "head entry %p status %d",