sys/oss/gstosssink.c: And another caller that couldn't handle delay < 0 (unsigned integer overflow). Video now contin...

Original commit message from CVS:
* sys/oss/gstosssink.c: (gst_osssink_chain):
And another caller that couldn't handle delay < 0 (unsigned
integer overflow). Video now continues playing on an audio
buffer underrun, and the clock continues working. Audio still
stalls.
This commit is contained in:
Ronald S. Bultje 2004-03-07 02:51:33 +00:00
parent bc6e4f585c
commit 63e0fe099e
2 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2004-03-06 Ronald Bultje <rbultje@ronald.bitfreak.net>
* sys/oss/gstosssink.c: (gst_osssink_chain):
And another caller that couldn't handle delay < 0 (unsigned
integer overflow). Video now continues playing on an audio
buffer underrun, and the clock continues working. Audio still
stalls.
2004-03-06 Ronald Bultje <rbultje@ronald.bitfreak.net> 2004-03-06 Ronald Bultje <rbultje@ronald.bitfreak.net>
* sys/oss/gstosssink.c: (gst_osssink_get_delay), * sys/oss/gstosssink.c: (gst_osssink_get_delay),

View file

@ -337,6 +337,7 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
GstClockTime buftime, elementtime, soundtime; GstClockTime buftime, elementtime, soundtime;
guchar *data; guchar *data;
guint to_write; guint to_write;
gint delay;
/* this has to be an audio buffer */ /* this has to be an audio buffer */
osssink = GST_OSSSINK (gst_pad_get_parent (pad)); osssink = GST_OSSSINK (gst_pad_get_parent (pad));
@ -367,7 +368,10 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
to_write = GST_BUFFER_SIZE (buf); to_write = GST_BUFFER_SIZE (buf);
/* sync audio with buffers timestamp */ /* sync audio with buffers timestamp */
elementtime = gst_element_get_time (GST_ELEMENT (osssink)); elementtime = gst_element_get_time (GST_ELEMENT (osssink));
soundtime = elementtime + gst_osssink_get_delay (osssink) * GST_SECOND / GST_OSSELEMENT (osssink)->bps; delay = gst_osssink_get_delay (osssink);
if (delay < 0)
delay = 0;
soundtime = elementtime + delay * GST_SECOND / GST_OSSELEMENT (osssink)->bps;
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
buftime = GST_BUFFER_TIMESTAMP (buf); buftime = GST_BUFFER_TIMESTAMP (buf);
} else { } else {
@ -381,9 +385,9 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
elementtime, soundtime, buftime); elementtime, soundtime, buftime);
if (soundtime > buftime) { if (soundtime > buftime) {
/* full frames */ /* full frames */
guint throw_away = (soundtime - buftime) * GST_OSSELEMENT (osssink)->bps / GST_SECOND guint throw_away = (soundtime - buftime) * GST_OSSELEMENT (osssink)->bps / GST_SECOND;
/ GST_OSSELEMENT (osssink)->width / GST_OSSELEMENT (osssink)->channels throw_away &= ~(GST_OSSELEMENT (osssink)->width * GST_OSSELEMENT (osssink)->channels);
* GST_OSSELEMENT (osssink)->width * GST_OSSELEMENT (osssink)->channels; osssink->handled += throw_away;
if (throw_away >= GST_BUFFER_SIZE (buf)) { if (throw_away >= GST_BUFFER_SIZE (buf)) {
gst_data_unref (_data); gst_data_unref (_data);
return; return;