mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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:
parent
052844abd6
commit
9b249a2467
3 changed files with 17 additions and 29 deletions
|
@ -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>
|
2004-07-02 David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
|
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
|
||||||
|
|
|
@ -1264,31 +1264,11 @@ gst_alsa_xrun_recovery (GstAlsa * this)
|
||||||
this->period_count *= 2;
|
this->period_count *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* prepare the device again */
|
if (!(gst_alsa_stop_audio (this) && gst_alsa_start_audio (this))) {
|
||||||
if ((err = snd_pcm_drop (this->handle)) < 0) {
|
GST_ELEMENT_ERROR (this, RESOURCE, FAILED, (NULL),
|
||||||
GST_ERROR_OBJECT (this, "drop error: %s", snd_strerror (err));
|
("Error restarting audio after xrun"));
|
||||||
return FALSE;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -220,15 +220,15 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr)
|
||||||
GST_SECOND * this->played / this->format->rate -
|
GST_SECOND * this->played / this->format->rate -
|
||||||
gst_alsa_sink_get_time (this);
|
gst_alsa_sink_get_time (this);
|
||||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
|
||||||
gst_element_set_time_delay (GST_ELEMENT (this), MIN (value, delay),
|
gst_element_set_time_delay (GST_ELEMENT (this), value,
|
||||||
delay);
|
MIN (value, delay));
|
||||||
} else if (this->format
|
} else if (this->format
|
||||||
&& (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)
|
&& (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)
|
||||||
|| gst_event_discont_get_value (event, GST_FORMAT_BYTES,
|
|| gst_event_discont_get_value (event, GST_FORMAT_BYTES,
|
||||||
&value))) {
|
&value))) {
|
||||||
value = gst_alsa_samples_to_timestamp (this, value);
|
value = gst_alsa_samples_to_timestamp (this, value);
|
||||||
gst_element_set_time_delay (GST_ELEMENT (this), MIN (value, delay),
|
gst_element_set_time_delay (GST_ELEMENT (this), value, MIN (value,
|
||||||
delay);
|
delay));
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (this,
|
GST_WARNING_OBJECT (this,
|
||||||
"couldn't extract time from discont event. Bad things might happen!");
|
"couldn't extract time from discont event. Bad things might happen!");
|
||||||
|
|
Loading…
Reference in a new issue