summaryrefslogtreecommitdiffstats
path: root/sys/oss/gstosssink.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-12-16 21:47:40 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-12-16 21:47:40 +0000
commit36d1d0b44f7f02fc5ad3c9f57530841c0dc0c263 (patch)
tree9e387ea89fc074f31d9fcc6b158e285ba7b80b65 /sys/oss/gstosssink.c
parenta36185d92047329feb572299b78aa5457422c6a0 (diff)
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...
Diffstat (limited to 'sys/oss/gstosssink.c')
-rw-r--r--sys/oss/gstosssink.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c
index 8af9f84c..1c956c29 100644
--- a/sys/oss/gstosssink.c
+++ b/sys/oss/gstosssink.c
@@ -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);