Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 17 | #define LOG_TAG (mInService ? "AudioStreamInternalPlay_Service" \ |
| 18 | : "AudioStreamInternalPlay_Client") |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 19 | //#define LOG_NDEBUG 0 |
| 20 | #include <utils/Log.h> |
| 21 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 22 | #define ATRACE_TAG ATRACE_TAG_AUDIO |
| 23 | |
| 24 | #include <utils/Trace.h> |
| 25 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 26 | #include "client/AudioStreamInternalPlay.h" |
| 27 | #include "utility/AudioClock.h" |
| 28 | |
| 29 | using android::WrappingBuffer; |
| 30 | |
| 31 | using namespace aaudio; |
| 32 | |
| 33 | AudioStreamInternalPlay::AudioStreamInternalPlay(AAudioServiceInterface &serviceInterface, |
| 34 | bool inService) |
| 35 | : AudioStreamInternal(serviceInterface, inService) { |
| 36 | |
| 37 | } |
| 38 | |
| 39 | AudioStreamInternalPlay::~AudioStreamInternalPlay() {} |
| 40 | |
Phil Burk | 02fec70 | 2018-02-16 18:25:55 -0800 | [diff] [blame] | 41 | constexpr int kRampMSec = 10; // time to apply a change in volume |
| 42 | |
| 43 | aaudio_result_t AudioStreamInternalPlay::open(const AudioStreamBuilder &builder) { |
| 44 | aaudio_result_t result = AudioStreamInternal::open(builder); |
| 45 | if (result == AAUDIO_OK) { |
| 46 | // Sample rate is constrained to common values by now and should not overflow. |
| 47 | int32_t numFrames = kRampMSec * getSampleRate() / AAUDIO_MILLIS_PER_SECOND; |
| 48 | mVolumeRamp.setLengthInFrames(numFrames); |
| 49 | } |
| 50 | return result; |
| 51 | } |
| 52 | |
Phil Burk | 5cc83c3 | 2017-11-28 15:43:18 -0800 | [diff] [blame] | 53 | aaudio_result_t AudioStreamInternalPlay::requestPause() |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 54 | { |
Phil Burk | 5cc83c3 | 2017-11-28 15:43:18 -0800 | [diff] [blame] | 55 | aaudio_result_t result = stopCallback(); |
| 56 | if (result != AAUDIO_OK) { |
| 57 | return result; |
| 58 | } |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 59 | if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) { |
Phil Burk | 02fec70 | 2018-02-16 18:25:55 -0800 | [diff] [blame] | 60 | ALOGE("requestPauseInternal() mServiceStreamHandle invalid = 0x%08X", |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 61 | mServiceStreamHandle); |
| 62 | return AAUDIO_ERROR_INVALID_STATE; |
| 63 | } |
| 64 | |
| 65 | mClockModel.stop(AudioClock::getNanoseconds()); |
| 66 | setState(AAUDIO_STREAM_STATE_PAUSING); |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 67 | mAtomicTimestamp.clear(); |
Phil Burk | 965650e | 2017-09-07 21:00:09 -0700 | [diff] [blame] | 68 | return mServiceInterface.pauseStream(mServiceStreamHandle); |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 71 | aaudio_result_t AudioStreamInternalPlay::requestFlush() { |
| 72 | if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) { |
| 73 | ALOGE("AudioStreamInternal::requestFlush() mServiceStreamHandle invalid = 0x%08X", |
| 74 | mServiceStreamHandle); |
| 75 | return AAUDIO_ERROR_INVALID_STATE; |
| 76 | } |
| 77 | |
| 78 | setState(AAUDIO_STREAM_STATE_FLUSHING); |
| 79 | return mServiceInterface.flushStream(mServiceStreamHandle); |
| 80 | } |
| 81 | |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 82 | void AudioStreamInternalPlay::advanceClientToMatchServerPosition() { |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 83 | int64_t readCounter = mAudioEndpoint.getDataReadCounter(); |
| 84 | int64_t writeCounter = mAudioEndpoint.getDataWriteCounter(); |
| 85 | |
| 86 | // Bump offset so caller does not see the retrograde motion in getFramesRead(). |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 87 | int64_t offset = writeCounter - readCounter; |
| 88 | mFramesOffsetFromService += offset; |
| 89 | ALOGD("advanceClientToMatchServerPosition() readN = %lld, writeN = %lld, offset = %lld", |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 90 | (long long)readCounter, (long long)writeCounter, (long long)mFramesOffsetFromService); |
| 91 | |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 92 | // Force writeCounter to match readCounter. |
| 93 | // This is because we cannot change the read counter in the hardware. |
Phil Burk | b336e89 | 2017-07-05 15:35:43 -0700 | [diff] [blame] | 94 | mAudioEndpoint.setDataWriteCounter(readCounter); |
| 95 | } |
| 96 | |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 97 | void AudioStreamInternalPlay::onFlushFromServer() { |
| 98 | advanceClientToMatchServerPosition(); |
| 99 | } |
| 100 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 101 | // Write the data, block if needed and timeoutMillis > 0 |
| 102 | aaudio_result_t AudioStreamInternalPlay::write(const void *buffer, int32_t numFrames, |
| 103 | int64_t timeoutNanoseconds) |
| 104 | |
| 105 | { |
| 106 | return processData((void *)buffer, numFrames, timeoutNanoseconds); |
| 107 | } |
| 108 | |
| 109 | // Write as much data as we can without blocking. |
| 110 | aaudio_result_t AudioStreamInternalPlay::processDataNow(void *buffer, int32_t numFrames, |
| 111 | int64_t currentNanoTime, int64_t *wakeTimePtr) { |
| 112 | aaudio_result_t result = processCommands(); |
| 113 | if (result != AAUDIO_OK) { |
| 114 | return result; |
| 115 | } |
| 116 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 117 | const char *traceName = "aaWrNow"; |
| 118 | ATRACE_BEGIN(traceName); |
| 119 | |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 120 | if (mClockModel.isStarting()) { |
| 121 | // Still haven't got any timestamps from server. |
| 122 | // Keep waiting until we get some valid timestamps then start writing to the |
| 123 | // current buffer position. |
| 124 | ALOGD("processDataNow() wait for valid timestamps"); |
| 125 | // Sleep very briefly and hope we get a timestamp soon. |
| 126 | *wakeTimePtr = currentNanoTime + (2000 * AAUDIO_NANOS_PER_MICROSECOND); |
| 127 | ATRACE_END(); |
| 128 | return 0; |
| 129 | } |
| 130 | // If we have gotten this far then we have at least one timestamp from server. |
| 131 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 132 | // If a DMA channel or DSP is reading the other end then we have to update the readCounter. |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 133 | if (mAudioEndpoint.isFreeRunning()) { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 134 | // Update data queue based on the timing model. |
| 135 | int64_t estimatedReadCounter = mClockModel.convertTimeToPosition(currentNanoTime); |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 136 | // ALOGD("AudioStreamInternal::processDataNow() - estimatedReadCounter = %d", (int)estimatedReadCounter); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 137 | mAudioEndpoint.setDataReadCounter(estimatedReadCounter); |
| 138 | } |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 139 | |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 140 | if (mNeedCatchUp.isRequested()) { |
| 141 | // Catch an MMAP pointer that is already advancing. |
| 142 | // This will avoid initial underruns caused by a slow cold start. |
| 143 | advanceClientToMatchServerPosition(); |
| 144 | mNeedCatchUp.acknowledge(); |
| 145 | } |
| 146 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 147 | // If the read index passed the write index then consider it an underrun. |
Phil Burk | 2329638 | 2017-11-20 15:45:11 -0800 | [diff] [blame] | 148 | // For shared streams, the xRunCount is passed up from the service. |
| 149 | if (mAudioEndpoint.isFreeRunning() && mAudioEndpoint.getFullFramesAvailable() < 0) { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 150 | mXRunCount++; |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 151 | if (ATRACE_ENABLED()) { |
| 152 | ATRACE_INT("aaUnderRuns", mXRunCount); |
| 153 | } |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | // Write some data to the buffer. |
| 157 | //ALOGD("AudioStreamInternal::processDataNow() - writeNowWithConversion(%d)", numFrames); |
| 158 | int32_t framesWritten = writeNowWithConversion(buffer, numFrames); |
| 159 | //ALOGD("AudioStreamInternal::processDataNow() - tried to write %d frames, wrote %d", |
| 160 | // numFrames, framesWritten); |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 161 | if (ATRACE_ENABLED()) { |
| 162 | ATRACE_INT("aaWrote", framesWritten); |
| 163 | } |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 164 | |
| 165 | // Calculate an ideal time to wake up. |
| 166 | if (wakeTimePtr != nullptr && framesWritten >= 0) { |
| 167 | // By default wake up a few milliseconds from now. // TODO review |
| 168 | int64_t wakeTime = currentNanoTime + (1 * AAUDIO_NANOS_PER_MILLISECOND); |
| 169 | aaudio_stream_state_t state = getState(); |
| 170 | //ALOGD("AudioStreamInternal::processDataNow() - wakeTime based on %s", |
| 171 | // AAudio_convertStreamStateToText(state)); |
| 172 | switch (state) { |
| 173 | case AAUDIO_STREAM_STATE_OPEN: |
| 174 | case AAUDIO_STREAM_STATE_STARTING: |
| 175 | if (framesWritten != 0) { |
| 176 | // Don't wait to write more data. Just prime the buffer. |
| 177 | wakeTime = currentNanoTime; |
| 178 | } |
| 179 | break; |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 180 | case AAUDIO_STREAM_STATE_STARTED: |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 181 | { |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 182 | // When do we expect the next read burst to occur? |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 183 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 184 | // Calculate frame position based off of the writeCounter because |
| 185 | // the readCounter might have just advanced in the background, |
| 186 | // causing us to sleep until a later burst. |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 187 | int64_t nextPosition = mAudioEndpoint.getDataWriteCounter() + mFramesPerBurst |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 188 | - mAudioEndpoint.getBufferSizeInFrames(); |
Phil Burk | bcc3674 | 2017-08-31 17:24:51 -0700 | [diff] [blame] | 189 | wakeTime = mClockModel.convertPositionToTime(nextPosition); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 190 | } |
| 191 | break; |
| 192 | default: |
| 193 | break; |
| 194 | } |
| 195 | *wakeTimePtr = wakeTime; |
| 196 | |
| 197 | } |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 198 | |
| 199 | ATRACE_END(); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 200 | return framesWritten; |
| 201 | } |
| 202 | |
| 203 | |
| 204 | aaudio_result_t AudioStreamInternalPlay::writeNowWithConversion(const void *buffer, |
| 205 | int32_t numFrames) { |
| 206 | // ALOGD("AudioStreamInternal::writeNowWithConversion(%p, %d)", |
| 207 | // buffer, numFrames); |
| 208 | WrappingBuffer wrappingBuffer; |
Phil Burk | 41f19d8 | 2018-02-13 14:59:10 -0800 | [diff] [blame] | 209 | uint8_t *byteBuffer = (uint8_t *) buffer; |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 210 | int32_t framesLeft = numFrames; |
| 211 | |
| 212 | mAudioEndpoint.getEmptyFramesAvailable(&wrappingBuffer); |
| 213 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 214 | // Write data in one or two parts. |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 215 | int partIndex = 0; |
| 216 | while (framesLeft > 0 && partIndex < WrappingBuffer::SIZE) { |
| 217 | int32_t framesToWrite = framesLeft; |
| 218 | int32_t framesAvailable = wrappingBuffer.numFrames[partIndex]; |
| 219 | if (framesAvailable > 0) { |
| 220 | if (framesToWrite > framesAvailable) { |
| 221 | framesToWrite = framesAvailable; |
| 222 | } |
Phil Burk | 41f19d8 | 2018-02-13 14:59:10 -0800 | [diff] [blame] | 223 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 224 | int32_t numBytes = getBytesPerFrame() * framesToWrite; |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 225 | // Data conversion. |
| 226 | float levelFrom; |
| 227 | float levelTo; |
Phil Burk | 41f19d8 | 2018-02-13 14:59:10 -0800 | [diff] [blame] | 228 | mVolumeRamp.nextSegment(framesToWrite, &levelFrom, &levelTo); |
| 229 | |
| 230 | AAudioDataConverter::FormattedData source( |
| 231 | (void *)byteBuffer, |
| 232 | getFormat(), |
| 233 | getSamplesPerFrame()); |
| 234 | AAudioDataConverter::FormattedData destination( |
| 235 | wrappingBuffer.data[partIndex], |
| 236 | getDeviceFormat(), |
| 237 | getDeviceChannelCount()); |
| 238 | |
| 239 | AAudioDataConverter::convert(source, destination, framesToWrite, |
| 240 | levelFrom, levelTo); |
| 241 | |
| 242 | byteBuffer += numBytes; |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 243 | framesLeft -= framesToWrite; |
| 244 | } else { |
| 245 | break; |
| 246 | } |
| 247 | partIndex++; |
| 248 | } |
| 249 | int32_t framesWritten = numFrames - framesLeft; |
| 250 | mAudioEndpoint.advanceWriteIndex(framesWritten); |
| 251 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 252 | // ALOGD("AudioStreamInternal::writeNowWithConversion() returns %d", framesWritten); |
| 253 | return framesWritten; |
| 254 | } |
| 255 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 256 | int64_t AudioStreamInternalPlay::getFramesRead() |
| 257 | { |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 258 | int64_t framesReadHardware; |
| 259 | if (isActive()) { |
| 260 | framesReadHardware = mClockModel.convertTimeToPosition(AudioClock::getNanoseconds()); |
| 261 | } else { |
| 262 | framesReadHardware = mAudioEndpoint.getDataReadCounter(); |
| 263 | } |
| 264 | int64_t framesRead = framesReadHardware + mFramesOffsetFromService; |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 265 | // Prevent retrograde motion. |
| 266 | if (framesRead < mLastFramesRead) { |
| 267 | framesRead = mLastFramesRead; |
| 268 | } else { |
| 269 | mLastFramesRead = framesRead; |
| 270 | } |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 271 | //ALOGD("AudioStreamInternalPlay::getFramesRead() returns %lld", (long long)framesRead); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 272 | return framesRead; |
| 273 | } |
| 274 | |
| 275 | int64_t AudioStreamInternalPlay::getFramesWritten() |
| 276 | { |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 277 | int64_t framesWritten = mAudioEndpoint.getDataWriteCounter() |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 278 | + mFramesOffsetFromService; |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 279 | //ALOGD("AudioStreamInternalPlay::getFramesWritten() returns %lld", (long long)framesWritten); |
| 280 | return framesWritten; |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | |
| 284 | // Render audio in the application callback and then write the data to the stream. |
| 285 | void *AudioStreamInternalPlay::callbackLoop() { |
| 286 | aaudio_result_t result = AAUDIO_OK; |
| 287 | aaudio_data_callback_result_t callbackResult = AAUDIO_CALLBACK_RESULT_CONTINUE; |
Phil Burk | 134f197 | 2017-12-08 13:06:11 -0800 | [diff] [blame] | 288 | if (!isDataCallbackSet()) return NULL; |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 289 | int64_t timeoutNanos = calculateReasonableTimeout(mCallbackFrames); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 290 | |
| 291 | // result might be a frame count |
| 292 | while (mCallbackEnabled.load() && isActive() && (result >= 0)) { |
| 293 | // Call application using the AAudio callback interface. |
Phil Burk | 134f197 | 2017-12-08 13:06:11 -0800 | [diff] [blame] | 294 | callbackResult = maybeCallDataCallback(mCallbackBuffer, mCallbackFrames); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 295 | |
| 296 | if (callbackResult == AAUDIO_CALLBACK_RESULT_CONTINUE) { |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 297 | // Write audio data to stream. This is a BLOCKING WRITE! |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 298 | result = write(mCallbackBuffer, mCallbackFrames, timeoutNanos); |
| 299 | if ((result != mCallbackFrames)) { |
| 300 | ALOGE("AudioStreamInternalPlay(): callbackLoop: write() returned %d", result); |
| 301 | if (result >= 0) { |
| 302 | // Only wrote some of the frames requested. Must have timed out. |
| 303 | result = AAUDIO_ERROR_TIMEOUT; |
| 304 | } |
Phil Burk | 134f197 | 2017-12-08 13:06:11 -0800 | [diff] [blame] | 305 | maybeCallErrorCallback(result); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 306 | break; |
| 307 | } |
| 308 | } else if (callbackResult == AAUDIO_CALLBACK_RESULT_STOP) { |
| 309 | ALOGD("AudioStreamInternalPlay(): callback returned AAUDIO_CALLBACK_RESULT_STOP"); |
| 310 | break; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | ALOGD("AudioStreamInternalPlay(): callbackLoop() exiting, result = %d, isActive() = %d", |
| 315 | result, (int) isActive()); |
| 316 | return NULL; |
| 317 | } |
Phil Burk | 965650e | 2017-09-07 21:00:09 -0700 | [diff] [blame] | 318 | |
| 319 | //------------------------------------------------------------------------------ |
| 320 | // Implementation of PlayerBase |
| 321 | status_t AudioStreamInternalPlay::doSetVolume() { |
| 322 | mVolumeRamp.setTarget(mStreamVolume * getDuckAndMuteVolume()); |
| 323 | return android::NO_ERROR; |
| 324 | } |