mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
Fix some clocking issue in OSS. The issue is that if we seek forward (note: specifically forward-only), then we call ...
Original commit message from CVS: Fix some clocking issue in OSS. The issue is that if we seek forward (note: specifically forward-only), then we call handle_discont() before re-setting the clock to active. However, gstclock.c tells us that handle_discont only succeeds if allow_discont=TRUE, which is set in... set_active(TRUE). So, we first need to re-activate the clock and *then* call handle_discont(). More importantly, though, we should **NEVER EVER EVER EVER EVER** **NEVER EVER EVER EVER EVER** call clock_wait() after a forward discont without first having called handle_discont(). I don't know who added that code, but it's beyond fundamentally broken. clock_wait() **WAITS** until we're at the new given buftime, so if we do that on a forward-seek buffer, we... yes! we wait the amount of time that we seeked forward. Anyway, Apparently this code has been in here for quite a long time so I don't get how this can ever have worked...
This commit is contained in:
parent
a36185d920
commit
36d1d0b44f
1 changed files with 8 additions and 15 deletions
|
@ -327,7 +327,7 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
|
|||
GstBuffer *buf = GST_BUFFER (_data);
|
||||
GstOssSink *osssink;
|
||||
GstClockTime buftime;
|
||||
|
||||
g_print ("OSS data\n");
|
||||
/* this has to be an audio buffer */
|
||||
osssink = GST_OSSSINK (gst_pad_get_parent (pad));
|
||||
|
||||
|
@ -343,7 +343,7 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
|
|||
case GST_EVENT_DISCONTINUOUS:
|
||||
{
|
||||
gint64 value;
|
||||
|
||||
g_print ("OSS reset\n");
|
||||
ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET);
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
||||
if (!gst_clock_handle_discont (osssink->clock, value))
|
||||
|
@ -351,6 +351,7 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
|
|||
osssink->handled = 0;
|
||||
}
|
||||
osssink->resync = TRUE;
|
||||
g_print ("OSS reset done\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -378,23 +379,15 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
|
|||
if (osssink->clock) {
|
||||
gint delay = 0;
|
||||
gint64 queued;
|
||||
GstClockTimeDiff jitter;
|
||||
|
||||
delay = gst_osssink_get_delay (osssink);
|
||||
queued = delay * GST_SECOND / GST_OSSELEMENT (osssink)->bps;
|
||||
|
||||
if (osssink->resync && osssink->sync) {
|
||||
GstClockID id = gst_clock_new_single_shot_id (osssink->clock, buftime - queued);
|
||||
|
||||
gst_element_clock_wait (GST_ELEMENT (osssink), id, &jitter);
|
||||
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;
|
||||
}
|
||||
gst_audio_clock_set_active ((GstAudioClock*)osssink->provided_clock, TRUE);
|
||||
gst_clock_handle_discont (osssink->clock, buftime - queued);
|
||||
to_write = size;
|
||||
osssink->resync = FALSE;
|
||||
}
|
||||
else {
|
||||
to_write = size;
|
||||
|
@ -427,7 +420,7 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_print ("OSS data done\n");
|
||||
gst_audio_clock_update_time ((GstAudioClock*)osssink->provided_clock, buftime);
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
|
Loading…
Reference in a new issue