mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Try to catch certain driver errors
... by verifying return values of snd_pcm_avail_update() and snd_pcm_begin_mmap() for their sanenness.
This commit is contained in:
parent
16471915af
commit
ef9f3f6ec4
4 changed files with 69 additions and 6 deletions
|
|
@ -261,7 +261,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec) {
|
|||
/* First we determine how many samples are missing to fill the
|
||||
* buffer up to 100% */
|
||||
|
||||
if (PA_UNLIKELY((n = snd_pcm_avail_update(u->pcm_handle)) < 0)) {
|
||||
if (PA_UNLIKELY((n = pa_alsa_safe_avail_update(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
|
||||
|
||||
if ((r = try_recover(u, "snd_pcm_avail_update", (int) n)) == 0)
|
||||
continue;
|
||||
|
|
@ -299,7 +299,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec) {
|
|||
|
||||
/* pa_log_debug("%lu frames to write", (unsigned long) frames); */
|
||||
|
||||
if (PA_UNLIKELY((err = snd_pcm_mmap_begin(u->pcm_handle, &areas, &offset, &frames)) < 0)) {
|
||||
if (PA_UNLIKELY((err = pa_alsa_safe_mmap_begin(u->pcm_handle, &areas, &offset, &frames, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
|
||||
|
||||
if ((r = try_recover(u, "snd_pcm_mmap_begin", err)) == 0)
|
||||
continue;
|
||||
|
|
@ -374,7 +374,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec) {
|
|||
|
||||
snd_pcm_hwsync(u->pcm_handle);
|
||||
|
||||
if (PA_UNLIKELY((n = snd_pcm_avail_update(u->pcm_handle)) < 0)) {
|
||||
if (PA_UNLIKELY((n = pa_alsa_safe_avail_update(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
|
||||
|
||||
if ((r = try_recover(u, "snd_pcm_avail_update", (int) n)) == 0)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue