+
+ if (G_UNLIKELY (dsoundsink->write_wait_clock_id == NULL ||
+ gst_clock_single_shot_id_reinit (dsoundsink->system_clock,
+ dsoundsink->write_wait_clock_id, sleep_until) == FALSE)) {
+
+ if (dsoundsink->write_wait_clock_id != NULL) {
+ gst_clock_id_unref (dsoundsink->write_wait_clock_id);
+ }
+
+ dsoundsink->write_wait_clock_id =
+ gst_clock_new_single_shot_id (dsoundsink->system_clock,
+ sleep_until);
+ }
+
+ clock_id = dsoundsink->write_wait_clock_id;
+ dsoundsink->reset_while_sleeping = FALSE;
+
+ GST_DSOUND_UNLOCK (dsoundsink);
+
+ /* don't bother with the return value as we'll detect reset separately,
+ as reset could happen between when this returns and we obtain the lock
+ again -- so we can't use UNSCHEDULED here */
+ gst_clock_id_wait (clock_id, NULL);
+
+ GST_DSOUND_LOCK (dsoundsink);
+
+ /* if a reset occurs, exit now */
+ if (dsoundsink->reset_while_sleeping == TRUE) {
+ GST_DSOUND_UNLOCK (dsoundsink);
+ return -1;
+ }