Loading media/libaaudio/src/client/AudioStreamInternal.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -501,9 +501,9 @@ aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *mes ALOGW("%s - AAUDIO_SERVICE_EVENT_DISCONNECTED - FIFO cleared", __func__); break; case AAUDIO_SERVICE_EVENT_VOLUME: ALOGD("%s - AAUDIO_SERVICE_EVENT_VOLUME %lf", __func__, message->event.dataDouble); mStreamVolume = (float)message->event.dataDouble; doSetVolume(); ALOGD("%s - AAUDIO_SERVICE_EVENT_VOLUME %lf", __func__, message->event.dataDouble); break; case AAUDIO_SERVICE_EVENT_XRUN: mXRunCount = static_cast<int32_t>(message->event.dataLong); Loading media/libaaudio/src/client/AudioStreamInternalPlay.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ aaudio_result_t AudioStreamInternalPlay::processDataNow(void *buffer, int32_t nu // Still haven't got any timestamps from server. // Keep waiting until we get some valid timestamps then start writing to the // current buffer position. ALOGD("%s() wait for valid timestamps", __func__); ALOGV("%s() wait for valid timestamps", __func__); // Sleep very briefly and hope we get a timestamp soon. *wakeTimePtr = currentNanoTime + (2000 * AAUDIO_NANOS_PER_MICROSECOND); ATRACE_END(); Loading Loading @@ -310,6 +310,9 @@ void *AudioStreamInternalPlay::callbackLoop() { //------------------------------------------------------------------------------ // Implementation of PlayerBase status_t AudioStreamInternalPlay::doSetVolume() { mVolumeRamp.setTarget(mStreamVolume * getDuckAndMuteVolume()); float combinedVolume = mStreamVolume * getDuckAndMuteVolume(); ALOGD("%s() mStreamVolume * duckAndMuteVolume = %f * %f = %f", __func__, mStreamVolume, getDuckAndMuteVolume(), combinedVolume); mVolumeRamp.setTarget(combinedVolume); return android::NO_ERROR; } media/libaaudio/src/core/AudioStream.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -428,6 +428,12 @@ android::media::VolumeShaper::Status AudioStream::applyVolumeShaper( } #endif void AudioStream::setDuckAndMuteVolume(float duckAndMuteVolume) { ALOGD("%s() to %f", __func__, duckAndMuteVolume); mDuckAndMuteVolume = duckAndMuteVolume; doSetVolume(); // apply this change } AudioStream::MyPlayerBase::MyPlayerBase(AudioStream *parent) : mParent(parent) { } Loading @@ -449,7 +455,6 @@ void AudioStream::MyPlayerBase::unregisterWithAudioManager() { } } void AudioStream::MyPlayerBase::destroy() { unregisterWithAudioManager(); } media/libaaudio/src/core/AudioStream.h +1 −4 Original line number Diff line number Diff line Loading @@ -328,10 +328,7 @@ public: } // This is used by the AudioManager to duck and mute the stream when changing audio focus. void setDuckAndMuteVolume(float duckAndMuteVolume) { mDuckAndMuteVolume = duckAndMuteVolume; doSetVolume(); // apply this change } void setDuckAndMuteVolume(float duckAndMuteVolume); float getDuckAndMuteVolume() const { return mDuckAndMuteVolume; Loading media/libaaudio/src/core/AudioStreamBuilder.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ static aaudio_result_t builder_createStream(aaudio_direction_t direction, break; default: ALOGE("bad direction = %d", direction); ALOGE("%s() bad direction = %d", __func__, direction); result = AAUDIO_ERROR_ILLEGAL_ARGUMENT; } return result; Loading @@ -99,7 +99,7 @@ static aaudio_result_t builder_createStream(aaudio_direction_t direction, aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { AudioStream *audioStream = nullptr; if (streamPtr == nullptr) { ALOGE("build() streamPtr is null"); ALOGE("%s() streamPtr is null", __func__); return AAUDIO_ERROR_NULL; } *streamPtr = nullptr; Loading @@ -124,13 +124,11 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { if (mapExclusivePolicy == AAUDIO_UNSPECIFIED) { mapExclusivePolicy = AAUDIO_MMAP_EXCLUSIVE_POLICY_DEFAULT; } ALOGD("mmapPolicy = %d, mapExclusivePolicy = %d", mmapPolicy, mapExclusivePolicy); aaudio_sharing_mode_t sharingMode = getSharingMode(); if ((sharingMode == AAUDIO_SHARING_MODE_EXCLUSIVE) && (mapExclusivePolicy == AAUDIO_POLICY_NEVER)) { ALOGW("EXCLUSIVE sharing mode not supported. Use SHARED."); ALOGD("%s() EXCLUSIVE sharing mode not supported. Use SHARED.", __func__); sharingMode = AAUDIO_SHARING_MODE_SHARED; setSharingMode(sharingMode); } Loading @@ -141,13 +139,14 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { // TODO Support other performance settings in MMAP mode. // Disable MMAP if low latency not requested. if (getPerformanceMode() != AAUDIO_PERFORMANCE_MODE_LOW_LATENCY) { ALOGD("build() MMAP not available because AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not used."); ALOGD("%s() MMAP not available because AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not used.", __func__); allowMMap = false; } // SessionID and Effects are only supported in Legacy mode. if (getSessionId() != AAUDIO_SESSION_ID_NONE) { ALOGD("build() MMAP not available because sessionId used."); ALOGD("%s() MMAP not available because sessionId used.", __func__); allowMMap = false; } Loading @@ -163,7 +162,7 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { audioStream = nullptr; if (isMMap && allowLegacy) { ALOGD("build() MMAP stream did not open so try Legacy path"); ALOGV("%s() MMAP stream did not open so try Legacy path", __func__); // If MMAP stream failed to open then TRY using a legacy stream. result = builder_createStream(getDirection(), sharingMode, false, &audioStream); Loading Loading
media/libaaudio/src/client/AudioStreamInternal.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -501,9 +501,9 @@ aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *mes ALOGW("%s - AAUDIO_SERVICE_EVENT_DISCONNECTED - FIFO cleared", __func__); break; case AAUDIO_SERVICE_EVENT_VOLUME: ALOGD("%s - AAUDIO_SERVICE_EVENT_VOLUME %lf", __func__, message->event.dataDouble); mStreamVolume = (float)message->event.dataDouble; doSetVolume(); ALOGD("%s - AAUDIO_SERVICE_EVENT_VOLUME %lf", __func__, message->event.dataDouble); break; case AAUDIO_SERVICE_EVENT_XRUN: mXRunCount = static_cast<int32_t>(message->event.dataLong); Loading
media/libaaudio/src/client/AudioStreamInternalPlay.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ aaudio_result_t AudioStreamInternalPlay::processDataNow(void *buffer, int32_t nu // Still haven't got any timestamps from server. // Keep waiting until we get some valid timestamps then start writing to the // current buffer position. ALOGD("%s() wait for valid timestamps", __func__); ALOGV("%s() wait for valid timestamps", __func__); // Sleep very briefly and hope we get a timestamp soon. *wakeTimePtr = currentNanoTime + (2000 * AAUDIO_NANOS_PER_MICROSECOND); ATRACE_END(); Loading Loading @@ -310,6 +310,9 @@ void *AudioStreamInternalPlay::callbackLoop() { //------------------------------------------------------------------------------ // Implementation of PlayerBase status_t AudioStreamInternalPlay::doSetVolume() { mVolumeRamp.setTarget(mStreamVolume * getDuckAndMuteVolume()); float combinedVolume = mStreamVolume * getDuckAndMuteVolume(); ALOGD("%s() mStreamVolume * duckAndMuteVolume = %f * %f = %f", __func__, mStreamVolume, getDuckAndMuteVolume(), combinedVolume); mVolumeRamp.setTarget(combinedVolume); return android::NO_ERROR; }
media/libaaudio/src/core/AudioStream.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -428,6 +428,12 @@ android::media::VolumeShaper::Status AudioStream::applyVolumeShaper( } #endif void AudioStream::setDuckAndMuteVolume(float duckAndMuteVolume) { ALOGD("%s() to %f", __func__, duckAndMuteVolume); mDuckAndMuteVolume = duckAndMuteVolume; doSetVolume(); // apply this change } AudioStream::MyPlayerBase::MyPlayerBase(AudioStream *parent) : mParent(parent) { } Loading @@ -449,7 +455,6 @@ void AudioStream::MyPlayerBase::unregisterWithAudioManager() { } } void AudioStream::MyPlayerBase::destroy() { unregisterWithAudioManager(); }
media/libaaudio/src/core/AudioStream.h +1 −4 Original line number Diff line number Diff line Loading @@ -328,10 +328,7 @@ public: } // This is used by the AudioManager to duck and mute the stream when changing audio focus. void setDuckAndMuteVolume(float duckAndMuteVolume) { mDuckAndMuteVolume = duckAndMuteVolume; doSetVolume(); // apply this change } void setDuckAndMuteVolume(float duckAndMuteVolume); float getDuckAndMuteVolume() const { return mDuckAndMuteVolume; Loading
media/libaaudio/src/core/AudioStreamBuilder.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ static aaudio_result_t builder_createStream(aaudio_direction_t direction, break; default: ALOGE("bad direction = %d", direction); ALOGE("%s() bad direction = %d", __func__, direction); result = AAUDIO_ERROR_ILLEGAL_ARGUMENT; } return result; Loading @@ -99,7 +99,7 @@ static aaudio_result_t builder_createStream(aaudio_direction_t direction, aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { AudioStream *audioStream = nullptr; if (streamPtr == nullptr) { ALOGE("build() streamPtr is null"); ALOGE("%s() streamPtr is null", __func__); return AAUDIO_ERROR_NULL; } *streamPtr = nullptr; Loading @@ -124,13 +124,11 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { if (mapExclusivePolicy == AAUDIO_UNSPECIFIED) { mapExclusivePolicy = AAUDIO_MMAP_EXCLUSIVE_POLICY_DEFAULT; } ALOGD("mmapPolicy = %d, mapExclusivePolicy = %d", mmapPolicy, mapExclusivePolicy); aaudio_sharing_mode_t sharingMode = getSharingMode(); if ((sharingMode == AAUDIO_SHARING_MODE_EXCLUSIVE) && (mapExclusivePolicy == AAUDIO_POLICY_NEVER)) { ALOGW("EXCLUSIVE sharing mode not supported. Use SHARED."); ALOGD("%s() EXCLUSIVE sharing mode not supported. Use SHARED.", __func__); sharingMode = AAUDIO_SHARING_MODE_SHARED; setSharingMode(sharingMode); } Loading @@ -141,13 +139,14 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { // TODO Support other performance settings in MMAP mode. // Disable MMAP if low latency not requested. if (getPerformanceMode() != AAUDIO_PERFORMANCE_MODE_LOW_LATENCY) { ALOGD("build() MMAP not available because AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not used."); ALOGD("%s() MMAP not available because AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not used.", __func__); allowMMap = false; } // SessionID and Effects are only supported in Legacy mode. if (getSessionId() != AAUDIO_SESSION_ID_NONE) { ALOGD("build() MMAP not available because sessionId used."); ALOGD("%s() MMAP not available because sessionId used.", __func__); allowMMap = false; } Loading @@ -163,7 +162,7 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) { audioStream = nullptr; if (isMMap && allowLegacy) { ALOGD("build() MMAP stream did not open so try Legacy path"); ALOGV("%s() MMAP stream did not open so try Legacy path", __func__); // If MMAP stream failed to open then TRY using a legacy stream. result = builder_createStream(getDirection(), sharingMode, false, &audioStream); Loading