- if (G_UNLIKELY (diff == 0))
- status = GST_CLOCK_OK;
- else
- status = GST_CLOCK_EARLY;
-
- SET_ENTRY_STATUS (entry, status);
+ if (G_UNLIKELY (diff == 0)) {
+ if (G_UNLIKELY (!CAS_ENTRY_STATUS (entry, status, GST_CLOCK_OK))) {
+ status = GET_ENTRY_STATUS (entry);
+ if (G_LIKELY (status == GST_CLOCK_UNSCHEDULED))
+ gst_system_clock_cleanup_unscheduled (sysclock, entry);
+ else
+ GST_CAT_ERROR (GST_CAT_CLOCK, "unexpected status %d for entry %p",
+ status, entry);
+ } else {
+ status = GST_CLOCK_OK;
+ }
+ } else {
+ if (G_UNLIKELY (!CAS_ENTRY_STATUS (entry, status, GST_CLOCK_EARLY))) {
+ status = GET_ENTRY_STATUS (entry);
+ if (G_LIKELY (status == GST_CLOCK_UNSCHEDULED))
+ gst_system_clock_cleanup_unscheduled (sysclock, entry);
+ else
+ GST_CAT_ERROR (GST_CAT_CLOCK, "unexpected status %d for entry %p",
+ status, entry);
+ } else {
+ status = GST_CLOCK_EARLY;
+ }
+ }