ext/alsa/gstalsasink.c: Fix bytes/samples confustion.

Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
Fix bytes/samples confustion.
(gst_alsa_sink_mmap), (gst_alsa_sink_loop):
Fix for underrun (#144389).
This commit is contained in:
Ronald S. Bultje 2004-11-10 14:53:49 +00:00
parent f1d2d752e6
commit 5aa107a360
2 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2004-11-10 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
Fix bytes/samples confustion.
(gst_alsa_sink_mmap), (gst_alsa_sink_loop):
Fix for underrun (#144389).
2004-11-09 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/typefind/gsttypefindfunctions.c: (mp3_type_find):

View file

@ -230,13 +230,17 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr)
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
gst_element_set_time_delay (GST_ELEMENT (this), value,
MIN (value, delay));
} else if (this->format
&& (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)
|| gst_event_discont_get_value (event, GST_FORMAT_BYTES,
&value))) {
} else if (this->format && (gst_event_discont_get_value (event,
GST_FORMAT_DEFAULT, &value))) {
value = gst_alsa_samples_to_timestamp (this, value);
gst_element_set_time_delay (GST_ELEMENT (this), value, MIN (value,
delay));
} else if (this->format
&& (gst_event_discont_get_value (event, GST_FORMAT_BYTES,
&value))) {
value = gst_alsa_bytes_to_timestamp (this, value);
gst_element_set_time_delay (GST_ELEMENT (this), value, MIN (value,
delay));
} else {
GST_WARNING_OBJECT (this,
"couldn't extract time from discont event. Bad things might happen!");
@ -302,7 +306,11 @@ gst_alsa_sink_mmap (GstAlsa * this, snd_pcm_sframes_t * avail)
goto out;
}
if ((err = snd_pcm_mmap_commit (this->handle, offset, *avail)) < 0) {
GST_ERROR_OBJECT (this, "mmap commit failed: %s", snd_strerror (err));
if (err == -EPIPE) {
gst_alsa_xrun_recovery (GST_ALSA (this));
} else {
GST_ERROR_OBJECT (this, "mmap commit failed: %s", snd_strerror (err));
}
goto out;
}
@ -381,6 +389,7 @@ sink_restart:
if (GST_IS_EVENT (sink->gst_data[i])) {
GST_LOG_OBJECT (sink, "pulled data %p is an event, checking",
sink->gst_data[i]);
if (gst_alsa_sink_check_event (sink, i))
continue;
return;