From f436fdcf93bd417fd3c9d2a8b19fd221d894b5e3 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 24 May 2012 11:07:14 -0700 Subject: audioflinger: change session check in createTrack. Do not refuse to create a track on an output thread if the same session is present on another thread. It is now possible that two tracks with the same session ID are on different threads if one can use deep buffering and the other can't. In this case, move effects attached to this session to the output thread ion which the new track is created. Bug 6530324. Change-Id: I9019b3ee382e374c89d2319033afcfa7f886e4c4 --- services/audioflinger/AudioFlinger.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'services') diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 68be7a70..57d70891 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -474,19 +474,15 @@ sp AudioFlinger::createTrack( ALOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId); if (sessionId != NULL && *sessionId != AUDIO_SESSION_OUTPUT_MIX) { + // check if an effect chain with the same session ID is present on another + // output thread and move it here. for (size_t i = 0; i < mPlaybackThreads.size(); i++) { sp t = mPlaybackThreads.valueAt(i); if (mPlaybackThreads.keyAt(i) != output) { - // prevent same audio session on different output threads uint32_t sessions = t->hasAudioSession(*sessionId); - if (sessions & PlaybackThread::TRACK_SESSION) { - ALOGE("createTrack() session ID %d already in use", *sessionId); - lStatus = BAD_VALUE; - goto Exit; - } - // check if an effect with same session ID is waiting for a track to be created if (sessions & PlaybackThread::EFFECT_SESSION) { effectThread = t.get(); + break; } } } -- cgit v1.2.3