[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] bluetooth: Only perform write-related calculations when we have a sink
Arun Raghavan
gitlab at gitlab.freedesktop.org
Tue Aug 27 03:25:27 UTC 2019
Arun Raghavan pushed to branch master at PulseAudio / pulseaudio
Commits:
bdf66c46 by Pali Rohár at 2019-08-27T03:14:27Z
bluetooth: Only perform write-related calculations when we have a sink
This avoids a potential divide-by-zero when we try to decide how much to
write to the sink in the source thread when there is no sink.
Fixes https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/717
- - - - -
1 changed file:
- src/modules/bluetooth/module-bluez5-device.c
Changes:
=====================================
src/modules/bluetooth/module-bluez5-device.c
=====================================
@@ -1378,7 +1378,7 @@ static void thread_func(void *userdata) {
if (have_source) {
/* We should send two blocks to the device before we expect a response. */
- if (u->write_index == 0 && u->read_index <= 0)
+ if (have_sink && u->write_index == 0 && u->read_index <= 0)
blocks_to_write = 2;
/* If we got woken up by POLLIN let's do some reading */
@@ -1393,7 +1393,7 @@ static void thread_func(void *userdata) {
if (n_read < 0)
goto fail;
- if (n_read > 0) {
+ if (have_sink && n_read > 0) {
/* We just read something, so we are supposed to write something, too */
bytes_to_write += n_read;
blocks_to_write += bytes_to_write / u->write_block_size;
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/bdf66c4693c8775dc3c4a403cbae77a56d4b1e29
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/bdf66c4693c8775dc3c4a403cbae77a56d4b1e29
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20190827/91bd623d/attachment.html>
More information about the pulseaudio-commits
mailing list