mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
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
This commit is contained in:
parent
1172daf19b
commit
bdf66c4693
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue