diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-11-26 11:01:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 11:01:36 +0100 |
commit | e8e3a780be06d24e4b777cc8855eb8397d2a1439 (patch) | |
tree | 67ad043c645129793de1596c758c86b79d944d7f | |
parent | 73551a1edc6f805f8e34838ffd98a5e9e40db992 (diff) | |
parent | b33464d1ae83a2fd6881807d06ecc88579aede49 (diff) |
Merge pull request #23965 from marcelofg55/pa_device_bugfix
Fix possible error when switching audio devices with PulseAudio
-rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 010f7bdb0a..720824d451 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -374,7 +374,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { const void *ptr = ad->samples_out.ptr(); ret = pa_stream_write(ad->pa_str, (char *)ptr + write_ofs, bytes_to_write, NULL, 0LL, PA_SEEK_RELATIVE); if (ret != 0) { - ERR_PRINT("pa_stream_write error"); + ERR_PRINTS("PulseAudio: pa_stream_write error: " + String(pa_strerror(ret))); } else { avail_bytes -= bytes_to_write; write_ofs += bytes_to_write; @@ -401,6 +401,9 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { break; } } + + avail_bytes = 0; + write_ofs = 0; } if (ad->pa_rec_str && pa_stream_get_state(ad->pa_rec_str) == PA_STREAM_READY) { |