check error code correctly

Original commit message from CVS:
check error code correctly
This commit is contained in:
Thomas Vander Stichele 2004-06-02 17:20:13 +00:00
parent 571a5cd7a6
commit 0c922cc90d
2 changed files with 17 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2004-06-02 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/alsa/gstalsaclock.c: (gst_alsa_clock_get_type):
* ext/alsa/gstalsasrc.c: (gst_alsa_src_loop):
check error condition on available samples correctly
2004-06-02 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/alsa/gstalsasrc.c: (gst_alsa_src_get_time):

View file

@ -329,11 +329,19 @@ gst_alsa_src_loop (GstElement * element)
}
}
while ((avail = gst_alsa_update_avail (this)) < this->period_size) {
if (avail == -EPIPE)
/* the cast to long is explicitly needed;
* with avail = -32 and period_size = 100, avail < period_size is false */
while ((avail = gst_alsa_update_avail (this)) < (long) this->period_size) {
if (avail == -EPIPE) {
GST_DEBUG_OBJECT (this, "got EPIPE when checking for available bytes");
continue;
if (avail < 0)
}
if (avail < 0) {
GST_DEBUG_OBJECT (this,
"got error %s (%d) when checking for available bytes",
snd_strerror (avail));
return;
}
if (snd_pcm_state (this->handle) != SND_PCM_STATE_RUNNING) {
if (!gst_alsa_start (this))
return;