diff options
author | Eric Laurent <elaurent@google.com> | 2012-05-24 11:07:14 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-05-24 11:07:14 -0700 |
commit | f436fdcf93bd417fd3c9d2a8b19fd221d894b5e3 (patch) | |
tree | 930951e6490510ef9eeab7210c8f729950783bd5 /services/audioflinger | |
parent | e737cda649acbfa43fc1b74612a83f2fac9aa449 (diff) | |
download | frameworks_av-f436fdcf93bd417fd3c9d2a8b19fd221d894b5e3.zip frameworks_av-f436fdcf93bd417fd3c9d2a8b19fd221d894b5e3.tar.gz frameworks_av-f436fdcf93bd417fd3c9d2a8b19fd221d894b5e3.tar.bz2 |
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
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 68be7a7..57d7089 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -474,19 +474,15 @@ sp<IAudioTrack> 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<PlaybackThread> 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; } } } |