ext/alsa/gstalsa.c: add debugging

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_pcm_wait):
add debugging
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
do a wait when we enter the loop func with no data available to
write instead of getting into an 100% CPU loop by just returning and
being called again by the scheduler
This commit is contained in:
Benjamin Otte 2004-11-13 01:08:31 +00:00
parent b15bb53be7
commit 1cb0235a08
3 changed files with 17 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2004-11-13 Benjamin Otte <otte@gnome.org>
* ext/alsa/gstalsa.c: (gst_alsa_pcm_wait):
add debugging
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
do a wait when we enter the loop func with no data available to
write instead of getting into an 100% CPU loop by just returning and
being called again by the scheduler
2004-11-13 Jan Schmidt <thaytan@mad.scientist.com>
* configure.ac:

View file

@ -1195,8 +1195,9 @@ inline gboolean
gst_alsa_pcm_wait (GstAlsa * this)
{
int err;
snd_pcm_state_t state = snd_pcm_state (this->handle);
if (snd_pcm_state (this->handle) == SND_PCM_STATE_RUNNING) {
if (state == SND_PCM_STATE_RUNNING) {
if ((err = snd_pcm_wait (this->handle, 1000)) < 0) {
if (err == EINTR) {
/* happens mostly when run under gdb, or when exiting due to a signal */
@ -1213,6 +1214,9 @@ gst_alsa_pcm_wait (GstAlsa * this)
return FALSE;
}
}
} else {
GST_INFO_OBJECT (this, "in state %s, not waiting",
snd_pcm_state_name (state));
}
return TRUE;
}

View file

@ -532,6 +532,9 @@ sink_restart:
if (sink->behaviour[i] != 1)
sink->buf_data[i] += bytes;
}
} else if (avail == 0 && gst_element_get_state (element) == GST_STATE_PLAYING) {
if (gst_alsa_pcm_wait (this) == FALSE)
return;
}
if (snd_pcm_state (this->handle) != SND_PCM_STATE_RUNNING