Go back to old code, it works good enough...

Original commit message from CVS:
Go back to old code, it works good enough...
This commit is contained in:
Ronald S. Bultje 2003-12-17 22:36:20 +00:00
parent 21693f54de
commit 9b57e0a57d

View file

@ -347,10 +347,10 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET); ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET);
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) { if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
if (!gst_clock_handle_discont (osssink->clock, value)) if (!gst_clock_handle_discont (osssink->clock, value))
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE); gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE);
osssink->handled = 0; osssink->handled = 0;
} }
osssink->resync = TRUE; osssink->resync = TRUE;
break; break;
} }
@ -379,15 +379,23 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
if (osssink->clock) { if (osssink->clock) {
gint delay = 0; gint delay = 0;
gint64 queued; gint64 queued;
GstClockTimeDiff jitter;
delay = gst_osssink_get_delay (osssink); delay = gst_osssink_get_delay (osssink);
queued = delay * GST_SECOND / GST_OSSELEMENT (osssink)->bps; queued = delay * GST_SECOND / GST_OSSELEMENT (osssink)->bps;
if (osssink->resync && osssink->sync) { if (osssink->resync && osssink->sync) {
gst_audio_clock_set_active ((GstAudioClock*)osssink->provided_clock, TRUE); GstClockID id = gst_clock_new_single_shot_id (osssink->clock, buftime - queued);
gst_clock_handle_discont (osssink->clock, buftime - queued);
to_write = size; gst_element_clock_wait (GST_ELEMENT (osssink), id, &jitter);
osssink->resync = FALSE; gst_clock_id_free (id);
if (jitter >= 0) {
gst_clock_handle_discont (osssink->clock, buftime - queued + jitter);
to_write = size;
gst_audio_clock_set_active ((GstAudioClock*)osssink->provided_clock, TRUE);
osssink->resync = FALSE;
}
} }
else { else {
to_write = size; to_write = size;