ext/alsa/gstalsa.c: use our own functions for restarting the alsa device.

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_xrun_recovery):
use our own functions for restarting the alsa device.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event):
I should apply patches myself - use MIN for the third argument, not
the second, this fixes seeking
This commit is contained in:
Benjamin Otte 2004-07-03 12:48:30 +00:00
parent 052844abd6
commit 9b249a2467
3 changed files with 17 additions and 29 deletions

View file

@ -1,3 +1,11 @@
2004-07-03 Benjamin Otte <otte@gnome.org>
* ext/alsa/gstalsa.c: (gst_alsa_xrun_recovery):
use our own functions for restarting the alsa device.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event):
I should apply patches myself - use MIN for the third argument, not
the second, this fixes seeking
2004-07-02 David Schleef <ds@schleef.org>
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),

View file

@ -1264,31 +1264,11 @@ gst_alsa_xrun_recovery (GstAlsa * this)
this->period_count *= 2;
}
}
/* prepare the device again */
if ((err = snd_pcm_drop (this->handle)) < 0) {
GST_ERROR_OBJECT (this, "drop error: %s", snd_strerror (err));
return FALSE;
}
if ((err = snd_pcm_drain (this->handle)) < 0) {
GST_ERROR_OBJECT (this, "drop error: %s", snd_strerror (err));
return FALSE;
}
if (!gst_alsa_start (this)) {
GST_ELEMENT_ERROR (this, RESOURCE, FAILED, (NULL),
("Error starting audio after xrun"));
return FALSE;
}
GST_DEBUG_OBJECT (this, "XRun!!!! of at least %.3f msecs, "
"pretending we captured %lld samples",
diff.tv_sec * 1000 + diff.tv_usec / 1000.0, this->captured);
} else {
if (!(gst_alsa_stop_audio (this) && gst_alsa_start_audio (this))) {
GST_ELEMENT_ERROR (this, RESOURCE, FAILED, (NULL),
("Error restarting audio after xrun"));
return FALSE;
}
}
if (!(gst_alsa_stop_audio (this) && gst_alsa_start_audio (this))) {
GST_ELEMENT_ERROR (this, RESOURCE, FAILED, (NULL),
("Error restarting audio after xrun"));
return FALSE;
}
return TRUE;

View file

@ -220,15 +220,15 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr)
GST_SECOND * this->played / this->format->rate -
gst_alsa_sink_get_time (this);
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
gst_element_set_time_delay (GST_ELEMENT (this), MIN (value, delay),
delay);
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))) {
value = gst_alsa_samples_to_timestamp (this, value);
gst_element_set_time_delay (GST_ELEMENT (this), MIN (value, delay),
delay);
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!");