summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/MediaPlayerService.cpp
diff options
context:
space:
mode:
authorYamit Mehta <ymehta@codeaurora.org>2015-07-20 13:52:10 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:24:17 -0600
commit174976417b6a85fd81e4951cd746028358d2f60b (patch)
tree45cccb474a7c778aa75eb18c2766d91e817010dd /media/libmediaplayerservice/MediaPlayerService.cpp
parent88801f57e848bddc03fbd6dbd6376a5467cc1d44 (diff)
downloadframeworks_av-174976417b6a85fd81e4951cd746028358d2f60b.zip
frameworks_av-174976417b6a85fd81e4951cd746028358d2f60b.tar.gz
frameworks_av-174976417b6a85fd81e4951cd746028358d2f60b.tar.bz2
libmediaplayerservice:Fix deadlock on gapless start failure
Issue:- Current gapless implementation starts the next clip when MEDIA_PLAYBACK_COMPLETE event for the first clip is recieved by MediaPlayerService. -Even if start for next clip fails, application is notified with MEDIA_INFO_STARTED_AS_NEXT. - This causes the framework to trigger mediaplayer start which again fails as it being for the same clip resulting in a deadlock in the mediaplayer. Fix:- Notify application with MEDIA_INFO_STARTED_AS_NEXT only when start for the next clip is successful. Change-Id: I77c570074c7c98c996122e275161ba88298e56fc
Diffstat (limited to 'media/libmediaplayerservice/MediaPlayerService.cpp')
-rwxr-xr-x[-rw-r--r--]media/libmediaplayerservice/MediaPlayerService.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index dbe8b31..25839df 100644..100755
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1249,8 +1249,17 @@ void MediaPlayerService::Client::notify(
if (msg == MEDIA_PLAYBACK_COMPLETE && client->mNextClient != NULL) {
if (client->mAudioOutput != NULL)
client->mAudioOutput->switchToNextOutput();
- client->mNextClient->start();
- client->mNextClient->mClient->notify(MEDIA_INFO, MEDIA_INFO_STARTED_AS_NEXT, 0, obj);
+ ALOGD("gapless:current track played back");
+ ALOGD("gapless:try to do a gapless switch to next track");
+ status_t ret;
+ ret = client->mNextClient->start();
+ if (ret == NO_ERROR) {
+ client->mNextClient->mClient->notify(MEDIA_INFO,
+ MEDIA_INFO_STARTED_AS_NEXT, 0, obj);
+ } else {
+ client->mClient->notify(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN , 0, obj);
+ ALOGW("gapless:start playback for next track failed");
+ }
}
}