commit Leif's alsa patch, it actually makes Alsa work better
Original commit message from CVS: commit Leif's alsa patch, it actually makes Alsa work better
This commit is contained in:
parent
e4d25f2f23
commit
f18d6d3825
@ -818,6 +818,8 @@ gst_alsa_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
xrun_detected = FALSE;
|
||||||
|
|
||||||
if (poll (&pfd, 1, 1000) < 0) {
|
if (poll (&pfd, 1, 1000) < 0) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
/* this happens mostly when run
|
/* this happens mostly when run
|
||||||
@ -831,8 +833,7 @@ gst_alsa_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pfd.revents & POLLERR) {
|
if (pfd.revents & POLLERR) {
|
||||||
g_warning("alsa: poll reports error.");
|
xrun_detected = TRUE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfd.revents == 0) {
|
if (pfd.revents == 0) {
|
||||||
@ -843,15 +844,12 @@ gst_alsa_loop (GstElement *element)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
xrun_detected = FALSE;
|
|
||||||
|
|
||||||
this->avail = snd_pcm_avail_update (this->handle);
|
this->avail = snd_pcm_avail_update (this->handle);
|
||||||
DEBUG ("snd_pcm_avail_update() = %d", (int)this->avail);
|
DEBUG ("snd_pcm_avail_update() = %d", (int)this->avail);
|
||||||
|
|
||||||
if (this->avail < 0) {
|
if (this->avail < 0) {
|
||||||
if (this->avail == -EPIPE) {
|
if (this->avail == -EPIPE) {
|
||||||
gst_alsa_xrun_recovery (this);
|
xrun_detected = TRUE;
|
||||||
this->avail = 0;
|
|
||||||
} else {
|
} else {
|
||||||
g_warning("unknown ALSA avail_update return value (%d)",
|
g_warning("unknown ALSA avail_update return value (%d)",
|
||||||
(int)this->avail);
|
(int)this->avail);
|
||||||
@ -859,6 +857,11 @@ gst_alsa_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (xrun_detected) {
|
||||||
|
gst_alsa_xrun_recovery (this);
|
||||||
|
this->avail = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* round down to nearest period_frames avail */
|
/* round down to nearest period_frames avail */
|
||||||
this->avail -= this->avail % this->period_frames;
|
this->avail -= this->avail % this->period_frames;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user