diff options
author | Eric Laurent <elaurent@google.com> | 2012-03-20 18:36:01 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-04-03 16:53:25 -0700 |
commit | 1a9ed11a472493cac7f6dfcbfac2064526a493ed (patch) | |
tree | 5f4a3c6856f294b3c0371afd87df96277215107b /media/libmedia/AudioTrack.cpp | |
parent | 290ca3a767a974ce9d041e5bcb0c69153f7851d5 (diff) |
audio policy: add configuration file
removed outputs to stream mapping cache in audio system: the output for a
given stream type must always be queried from audio policy manager as the cache
is not always updated fast enough by audioflinger callback.
removed AudioFlinger::PlaybackThread::setStreamValid() not used anymore if
stream to output mapping is not cached.
Change-Id: Ieca720c0b292181f81247259c8a44359bc74c66b
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index c619ad7c..6dc6c417 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -185,27 +185,23 @@ status_t AudioTrack::set( ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size()); + ALOGV("set() streamType %d frameCount %d flags %04x", streamType, frameCount, flags); + AutoMutex lock(mLock); if (mAudioTrack != 0) { ALOGE("Track already in use"); return INVALID_OPERATION; } - int afSampleRate; - if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { - return NO_INIT; - } - - uint32_t afLatency; - if (AudioSystem::getOutputLatency(&afLatency, streamType) != NO_ERROR) { - return NO_INIT; - } - // handle default values first. if (streamType == AUDIO_STREAM_DEFAULT) { streamType = AUDIO_STREAM_MUSIC; } + int afSampleRate; + if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { + return NO_INIT; + } if (sampleRate == 0) { sampleRate = afSampleRate; } @@ -751,15 +747,15 @@ status_t AudioTrack::createTrack_l( } int afSampleRate; - if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { + if (AudioSystem::getSamplingRate(output, streamType, &afSampleRate) != NO_ERROR) { return NO_INIT; } int afFrameCount; - if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) { + if (AudioSystem::getFrameCount(output, streamType, &afFrameCount) != NO_ERROR) { return NO_INIT; } uint32_t afLatency; - if (AudioSystem::getOutputLatency(&afLatency, streamType) != NO_ERROR) { + if (AudioSystem::getLatency(output, streamType, &afLatency) != NO_ERROR) { return NO_INIT; } @@ -774,6 +770,7 @@ status_t AudioTrack::createTrack_l( ALOGW("AUDIO_POLICY_OUTPUT_FLAG_FAST denied"); flags = (audio_policy_output_flags_t) (flags & ~AUDIO_POLICY_OUTPUT_FLAG_FAST); } + ALOGV("createTrack_l() output %d afFrameCount %d afLatency %d", output, afFrameCount, afLatency); mNotificationFramesAct = mNotificationFramesReq; if (!audio_is_linear_pcm(format)) { |