audio: returns error if poll_revents failed.
PATCH 1/1 audio: returns error if poll_revents failed.
Quoted 1 line
From
a79537c26867fd92f32e77a6fe59bf0e1dd61c11Mon Sep 17 00:00:00 2001
From: Vic Lee <[email protected]>
Date: Sat, 30 Jun 2012 20:16:18 +0800
Subject: [PATCH] audio: returns error if poll_revents failed.
Error must be reported back to ALSA if poll_revents failed. Otherwise, when the bluetooth audio device is disconnected during playback, ALSA will enter in an infinite loop, bluez will keep printing "read error", and application freezes.
Signed-off-by Vic Lee <[email protected]>
--- audio/pcm_bluetooth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
audio/pcm_bluetooth.c +5 -1
@@ -821,6 +821,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io, unsigned short *revents) {static char buf[1 ]; +int err =0 ;DBG ("" );
@@ -832,14 +833,17 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,if (io->state !=SND_PCM_STATE_PREPARED )if (read (pfds[0 ].fd, buf,1 ) <0 ) + {SYSERR ("read error: %s (%d)" ,strerror (errno), errno); + err =-1 ; + }if (pfds[1 ].revents & (POLLERR |POLLHUP |POLLNVAL )) io->state =SND_PCM_STATE_DISCONNECTED ; *revents = (pfds[0 ].revents &POLLIN ) ?POLLOUT :0 ; -return 0 ; +return err; }
Signature · 1 line
1.7.10
Hi Vic
Quoted 1 line · Vic Lee
First of all, please use git-sendemail for next patches.
This file was just removed from the tree, so there's no need for this patch anymore.
Lucas De Marchi