blob: 447f32c38876f0a08960829d21e15789e9c51a32 [file] [log] [blame]
Phil Burk39f02dd2017-08-04 09:13:31 -07001/*
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
17#define LOG_TAG "AAudioServiceEndpointMMAP"
18//#define LOG_NDEBUG 0
19#include <utils/Log.h>
20
21#include <algorithm>
22#include <assert.h>
23#include <map>
24#include <mutex>
25#include <sstream>
26#include <utils/Singleton.h>
27#include <vector>
28
29
30#include "AAudioEndpointManager.h"
31#include "AAudioServiceEndpoint.h"
32
33#include "core/AudioStreamBuilder.h"
34#include "AAudioServiceEndpoint.h"
35#include "AAudioServiceStreamShared.h"
36#include "AAudioServiceEndpointPlay.h"
37#include "AAudioServiceEndpointMMAP.h"
38
39
40#define AAUDIO_BUFFER_CAPACITY_MIN 4 * 512
41#define AAUDIO_SAMPLE_RATE_DEFAULT 48000
42
43// This is an estimate of the time difference between the HW and the MMAP time.
44// TODO Get presentation timestamps from the HAL instead of using these estimates.
45#define OUTPUT_ESTIMATED_HARDWARE_OFFSET_NANOS (3 * AAUDIO_NANOS_PER_MILLISECOND)
46#define INPUT_ESTIMATED_HARDWARE_OFFSET_NANOS (-1 * AAUDIO_NANOS_PER_MILLISECOND)
47
48using namespace android; // TODO just import names needed
49using namespace aaudio; // TODO just import names needed
50
Phil Burkbbd52862018-04-13 11:37:42 -070051
52AAudioServiceEndpointMMAP::AAudioServiceEndpointMMAP(AAudioService &audioService)
53 : mMmapStream(nullptr)
54 , mAAudioService(audioService) {}
Phil Burk39f02dd2017-08-04 09:13:31 -070055
56AAudioServiceEndpointMMAP::~AAudioServiceEndpointMMAP() {}
57
58std::string AAudioServiceEndpointMMAP::dump() const {
59 std::stringstream result;
60
61 result << " MMAP: framesTransferred = " << mFramesTransferred.get();
62 result << ", HW nanos = " << mHardwareTimeOffsetNanos;
63 result << ", port handle = " << mPortHandle;
64 result << ", audio data FD = " << mAudioDataFileDescriptor;
65 result << "\n";
66
67 result << " HW Offset Micros: " <<
68 (getHardwareTimeOffsetNanos()
69 / AAUDIO_NANOS_PER_MICROSECOND) << "\n";
70
71 result << AAudioServiceEndpoint::dump();
72 return result.str();
73}
74
75aaudio_result_t AAudioServiceEndpointMMAP::open(const aaudio::AAudioStreamRequest &request) {
76 aaudio_result_t result = AAUDIO_OK;
Phil Burk39f02dd2017-08-04 09:13:31 -070077 audio_config_base_t config;
78 audio_port_handle_t deviceId;
79
80 int32_t burstMinMicros = AAudioProperty_getHardwareBurstMinMicros();
81 int32_t burstMicros = 0;
82
83 copyFrom(request.getConstantConfiguration());
84
Phil Burkd4ccc622017-12-20 15:32:44 -080085 aaudio_direction_t direction = getDirection();
86
87 const audio_content_type_t contentType =
88 AAudioConvert_contentTypeToInternal(getContentType());
Phil Burk55e5eab2018-04-10 15:16:38 -070089 // Usage only used for OUTPUT
Phil Burkd4ccc622017-12-20 15:32:44 -080090 const audio_usage_t usage = (direction == AAUDIO_DIRECTION_OUTPUT)
91 ? AAudioConvert_usageToInternal(getUsage())
92 : AUDIO_USAGE_UNKNOWN;
93 const audio_source_t source = (direction == AAUDIO_DIRECTION_INPUT)
94 ? AAudioConvert_inputPresetToAudioSource(getInputPreset())
95 : AUDIO_SOURCE_DEFAULT;
Kevin Rocard68646ba2019-03-20 13:26:49 -070096 const audio_flags_mask_t flags = AUDIO_FLAG_LOW_LATENCY |
97 AAudioConvert_allowCapturePolicyToAudioFlagsMask(getAllowedCapturePolicy());
Phil Burkd4ccc622017-12-20 15:32:44 -080098
99 const audio_attributes_t attributes = {
100 .content_type = contentType,
101 .usage = usage,
102 .source = source,
Kevin Rocard68646ba2019-03-20 13:26:49 -0700103 .flags = flags,
Phil Burkd4ccc622017-12-20 15:32:44 -0800104 .tags = ""
105 };
Phil Burka62fb952018-01-16 12:44:06 -0800106
Phil Burk39f02dd2017-08-04 09:13:31 -0700107 mMmapClient.clientUid = request.getUserId();
108 mMmapClient.clientPid = request.getProcessId();
109 mMmapClient.packageName.setTo(String16(""));
110
111 mRequestedDeviceId = deviceId = getDeviceId();
112
113 // Fill in config
Phil Burk0127c1b2018-03-29 13:48:06 -0700114 audio_format_t audioFormat = getFormat();
115 if (audioFormat == AUDIO_FORMAT_DEFAULT || audioFormat == AUDIO_FORMAT_PCM_FLOAT) {
116 audioFormat = AUDIO_FORMAT_PCM_16_BIT;
Phil Burk39f02dd2017-08-04 09:13:31 -0700117 }
Phil Burk0127c1b2018-03-29 13:48:06 -0700118 config.format = audioFormat;
Phil Burk39f02dd2017-08-04 09:13:31 -0700119
120 int32_t aaudioSampleRate = getSampleRate();
121 if (aaudioSampleRate == AAUDIO_UNSPECIFIED) {
122 aaudioSampleRate = AAUDIO_SAMPLE_RATE_DEFAULT;
123 }
124 config.sample_rate = aaudioSampleRate;
125
126 int32_t aaudioSamplesPerFrame = getSamplesPerFrame();
127
Phil Burk39f02dd2017-08-04 09:13:31 -0700128 if (direction == AAUDIO_DIRECTION_OUTPUT) {
129 config.channel_mask = (aaudioSamplesPerFrame == AAUDIO_UNSPECIFIED)
130 ? AUDIO_CHANNEL_OUT_STEREO
131 : audio_channel_out_mask_from_count(aaudioSamplesPerFrame);
132 mHardwareTimeOffsetNanos = OUTPUT_ESTIMATED_HARDWARE_OFFSET_NANOS; // frames at DAC later
133
134 } else if (direction == AAUDIO_DIRECTION_INPUT) {
135 config.channel_mask = (aaudioSamplesPerFrame == AAUDIO_UNSPECIFIED)
136 ? AUDIO_CHANNEL_IN_STEREO
137 : audio_channel_in_mask_from_count(aaudioSamplesPerFrame);
138 mHardwareTimeOffsetNanos = INPUT_ESTIMATED_HARDWARE_OFFSET_NANOS; // frames at ADC earlier
139
140 } else {
Phil Burk19e990e2018-03-22 13:59:34 -0700141 ALOGE("%s() invalid direction = %d", __func__, direction);
Phil Burk39f02dd2017-08-04 09:13:31 -0700142 return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
143 }
144
145 MmapStreamInterface::stream_direction_t streamDirection =
146 (direction == AAUDIO_DIRECTION_OUTPUT)
147 ? MmapStreamInterface::DIRECTION_OUTPUT
148 : MmapStreamInterface::DIRECTION_INPUT;
149
Phil Burk4e1af9f2018-01-03 15:54:35 -0800150 aaudio_session_id_t requestedSessionId = getSessionId();
151 audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId);
152
Phil Burk39f02dd2017-08-04 09:13:31 -0700153 // Open HAL stream. Set mMmapStream
154 status_t status = MmapStreamInterface::openMmapStream(streamDirection,
155 &attributes,
156 &config,
157 mMmapClient,
158 &deviceId,
Phil Burk4e1af9f2018-01-03 15:54:35 -0800159 &sessionId,
Phil Burk39f02dd2017-08-04 09:13:31 -0700160 this, // callback
161 mMmapStream,
162 &mPortHandle);
Phil Burk19e990e2018-03-22 13:59:34 -0700163 ALOGD("%s() mMapClient.uid = %d, pid = %d => portHandle = %d\n",
164 __func__, mMmapClient.clientUid, mMmapClient.clientPid, mPortHandle);
Phil Burk39f02dd2017-08-04 09:13:31 -0700165 if (status != OK) {
Phil Burk29ccc292019-04-15 08:58:08 -0700166 // This can happen if the resource is busy or the config does
167 // not match the hardware.
168 ALOGD("%s() - openMmapStream() returned status %d", __func__, status);
Phil Burk39f02dd2017-08-04 09:13:31 -0700169 return AAUDIO_ERROR_UNAVAILABLE;
170 }
171
172 if (deviceId == AAUDIO_UNSPECIFIED) {
Phil Burka3901e92018-10-08 13:54:38 -0700173 ALOGW("%s() - openMmapStream() failed to set deviceId", __func__);
Phil Burk39f02dd2017-08-04 09:13:31 -0700174 }
175 setDeviceId(deviceId);
176
Phil Burk4e1af9f2018-01-03 15:54:35 -0800177 if (sessionId == AUDIO_SESSION_ALLOCATE) {
Phil Burk19e990e2018-03-22 13:59:34 -0700178 ALOGW("%s() - openMmapStream() failed to set sessionId", __func__);
Phil Burk4e1af9f2018-01-03 15:54:35 -0800179 }
180
181 aaudio_session_id_t actualSessionId =
182 (requestedSessionId == AAUDIO_SESSION_ID_NONE)
183 ? AAUDIO_SESSION_ID_NONE
184 : (aaudio_session_id_t) sessionId;
185 setSessionId(actualSessionId);
Phil Burk19e990e2018-03-22 13:59:34 -0700186 ALOGD("%s() deviceId = %d, sessionId = %d", __func__, getDeviceId(), getSessionId());
Phil Burk4e1af9f2018-01-03 15:54:35 -0800187
Phil Burk39f02dd2017-08-04 09:13:31 -0700188 // Create MMAP/NOIRQ buffer.
189 int32_t minSizeFrames = getBufferCapacity();
190 if (minSizeFrames <= 0) { // zero will get rejected
191 minSizeFrames = AAUDIO_BUFFER_CAPACITY_MIN;
192 }
193 status = mMmapStream->createMmapBuffer(minSizeFrames, &mMmapBufferinfo);
Kevin Rocard734334f2018-07-12 19:37:41 -0700194 bool isBufferShareable = mMmapBufferinfo.flags & AUDIO_MMAP_APPLICATION_SHAREABLE;
Phil Burk39f02dd2017-08-04 09:13:31 -0700195 if (status != OK) {
Phil Burk19e990e2018-03-22 13:59:34 -0700196 ALOGE("%s() - createMmapBuffer() failed with status %d %s",
197 __func__, status, strerror(-status));
Phil Burk39f02dd2017-08-04 09:13:31 -0700198 result = AAUDIO_ERROR_UNAVAILABLE;
199 goto error;
200 } else {
Phil Burk29ccc292019-04-15 08:58:08 -0700201 ALOGD("%s() createMmapBuffer() buffer_size = %d fr, burst_size %d fr"
Phil Burk39f02dd2017-08-04 09:13:31 -0700202 ", Sharable FD: %s",
Phil Burk29ccc292019-04-15 08:58:08 -0700203 __func__,
Kevin Rocard734334f2018-07-12 19:37:41 -0700204 mMmapBufferinfo.buffer_size_frames,
Phil Burk39f02dd2017-08-04 09:13:31 -0700205 mMmapBufferinfo.burst_size_frames,
Kevin Rocard734334f2018-07-12 19:37:41 -0700206 isBufferShareable ? "Yes" : "No");
Phil Burk39f02dd2017-08-04 09:13:31 -0700207 }
208
209 setBufferCapacity(mMmapBufferinfo.buffer_size_frames);
Kevin Rocard734334f2018-07-12 19:37:41 -0700210 if (!isBufferShareable) {
Phil Burk39f02dd2017-08-04 09:13:31 -0700211 // Exclusive mode can only be used by the service because the FD cannot be shared.
212 uid_t audioServiceUid = getuid();
213 if ((mMmapClient.clientUid != audioServiceUid) &&
214 getSharingMode() == AAUDIO_SHARING_MODE_EXCLUSIVE) {
Phil Burk19e990e2018-03-22 13:59:34 -0700215 ALOGW("%s() - exclusive FD cannot be used by client", __func__);
Phil Burk39f02dd2017-08-04 09:13:31 -0700216 result = AAUDIO_ERROR_UNAVAILABLE;
217 goto error;
218 }
219 }
220
221 // Get information about the stream and pass it back to the caller.
222 setSamplesPerFrame((direction == AAUDIO_DIRECTION_OUTPUT)
223 ? audio_channel_count_from_out_mask(config.channel_mask)
224 : audio_channel_count_from_in_mask(config.channel_mask));
225
226 // AAudio creates a copy of this FD and retains ownership of the copy.
227 // Assume that AudioFlinger will close the original shared_memory_fd.
228 mAudioDataFileDescriptor.reset(dup(mMmapBufferinfo.shared_memory_fd));
229 if (mAudioDataFileDescriptor.get() == -1) {
Phil Burk19e990e2018-03-22 13:59:34 -0700230 ALOGE("%s() - could not dup shared_memory_fd", __func__);
Phil Burk39f02dd2017-08-04 09:13:31 -0700231 result = AAUDIO_ERROR_INTERNAL;
232 goto error;
233 }
234 mFramesPerBurst = mMmapBufferinfo.burst_size_frames;
Phil Burk0127c1b2018-03-29 13:48:06 -0700235 setFormat(config.format);
Phil Burk39f02dd2017-08-04 09:13:31 -0700236 setSampleRate(config.sample_rate);
237
238 // Scale up the burst size to meet the minimum equivalent in microseconds.
239 // This is to avoid waking the CPU too often when the HW burst is very small
240 // or at high sample rates.
241 do {
242 if (burstMicros > 0) { // skip first loop
243 mFramesPerBurst *= 2;
244 }
245 burstMicros = mFramesPerBurst * static_cast<int64_t>(1000000) / getSampleRate();
246 } while (burstMicros < burstMinMicros);
247
Phil Burk29ccc292019-04-15 08:58:08 -0700248 ALOGD("%s() original burst = %d, minMicros = %d => burst = %d\n",
Phil Burk19e990e2018-03-22 13:59:34 -0700249 __func__, mMmapBufferinfo.burst_size_frames, burstMinMicros, mFramesPerBurst);
Phil Burk39f02dd2017-08-04 09:13:31 -0700250
Phil Burk29ccc292019-04-15 08:58:08 -0700251 ALOGD("%s() actual rate = %d, channels = %d, deviceId = %d\n",
252 __func__, getSampleRate(), getSamplesPerFrame(), deviceId);
Phil Burk39f02dd2017-08-04 09:13:31 -0700253
Phil Burk29ccc292019-04-15 08:58:08 -0700254 ALOGD("%s() format = 0x%08x, frame size = %d",
Phil Burk0127c1b2018-03-29 13:48:06 -0700255 __func__, getFormat(), calculateBytesPerFrame());
256
Phil Burk39f02dd2017-08-04 09:13:31 -0700257 return result;
258
259error:
260 close();
261 return result;
262}
263
264aaudio_result_t AAudioServiceEndpointMMAP::close() {
Phil Burk39f02dd2017-08-04 09:13:31 -0700265 if (mMmapStream != 0) {
Phil Burk39f02dd2017-08-04 09:13:31 -0700266 // Needs to be explicitly cleared or CTS will fail but it is not clear why.
267 mMmapStream.clear();
268 // Apparently the above close is asynchronous. An attempt to open a new device
269 // right after a close can fail. Also some callbacks may still be in flight!
270 // FIXME Make closing synchronous.
271 AudioClock::sleepForNanos(100 * AAUDIO_NANOS_PER_MILLISECOND);
272 }
273
274 return AAUDIO_OK;
275}
276
277aaudio_result_t AAudioServiceEndpointMMAP::startStream(sp<AAudioServiceStreamBase> stream,
Phil Burkbbd52862018-04-13 11:37:42 -0700278 audio_port_handle_t *clientHandle __unused) {
Phil Burkbcc36742017-08-31 17:24:51 -0700279 // Start the client on behalf of the AAudio service.
280 // Use the port handle that was provided by openMmapStream().
Phil Burkbbd52862018-04-13 11:37:42 -0700281 audio_port_handle_t tempHandle = mPortHandle;
282 aaudio_result_t result = startClient(mMmapClient, &tempHandle);
283 // When AudioFlinger is passed a valid port handle then it should not change it.
284 LOG_ALWAYS_FATAL_IF(tempHandle != mPortHandle,
285 "%s() port handle not expected to change from %d to %d",
286 __func__, mPortHandle, tempHandle);
Phil Burk29ccc292019-04-15 08:58:08 -0700287 ALOGV("%s() mPortHandle = %d", __func__, mPortHandle);
Phil Burkbbd52862018-04-13 11:37:42 -0700288 return result;
Phil Burk39f02dd2017-08-04 09:13:31 -0700289}
290
291aaudio_result_t AAudioServiceEndpointMMAP::stopStream(sp<AAudioServiceStreamBase> stream,
Phil Burkbbd52862018-04-13 11:37:42 -0700292 audio_port_handle_t clientHandle __unused) {
Phil Burk39f02dd2017-08-04 09:13:31 -0700293 mFramesTransferred.reset32();
Phil Burk73af62a2017-10-26 12:11:47 -0700294
295 // Round 64-bit counter up to a multiple of the buffer capacity.
296 // This is required because the 64-bit counter is used as an index
297 // into a circular buffer and the actual HW position is reset to zero
298 // when the stream is stopped.
299 mFramesTransferred.roundUp64(getBufferCapacity());
300
Phil Burkbbd52862018-04-13 11:37:42 -0700301 // Use the port handle that was provided by openMmapStream().
Phil Burk29ccc292019-04-15 08:58:08 -0700302 ALOGV("%s() mPortHandle = %d", __func__, mPortHandle);
Phil Burk39f02dd2017-08-04 09:13:31 -0700303 return stopClient(mPortHandle);
304}
305
306aaudio_result_t AAudioServiceEndpointMMAP::startClient(const android::AudioClient& client,
307 audio_port_handle_t *clientHandle) {
308 if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
Phil Burkbcc36742017-08-31 17:24:51 -0700309 status_t status = mMmapStream->start(client, clientHandle);
Phil Burk29ccc292019-04-15 08:58:08 -0700310 return AAudioConvert_androidToAAudioResult(status);
Phil Burk39f02dd2017-08-04 09:13:31 -0700311}
312
313aaudio_result_t AAudioServiceEndpointMMAP::stopClient(audio_port_handle_t clientHandle) {
314 if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
315 aaudio_result_t result = AAudioConvert_androidToAAudioResult(mMmapStream->stop(clientHandle));
Phil Burk39f02dd2017-08-04 09:13:31 -0700316 return result;
317}
318
319// Get free-running DSP or DMA hardware position from the HAL.
320aaudio_result_t AAudioServiceEndpointMMAP::getFreeRunningPosition(int64_t *positionFrames,
321 int64_t *timeNanos) {
322 struct audio_mmap_position position;
323 if (mMmapStream == nullptr) {
324 return AAUDIO_ERROR_NULL;
325 }
326 status_t status = mMmapStream->getMmapPosition(&position);
Phil Burk19e990e2018-03-22 13:59:34 -0700327 ALOGV("%s() status= %d, pos = %d, nanos = %lld\n",
328 __func__, status, position.position_frames, (long long) position.time_nanoseconds);
Phil Burk39f02dd2017-08-04 09:13:31 -0700329 aaudio_result_t result = AAudioConvert_androidToAAudioResult(status);
330 if (result == AAUDIO_ERROR_UNAVAILABLE) {
Phil Burk19e990e2018-03-22 13:59:34 -0700331 ALOGW("%s(): getMmapPosition() has no position data available", __func__);
Phil Burk39f02dd2017-08-04 09:13:31 -0700332 } else if (result != AAUDIO_OK) {
Phil Burk19e990e2018-03-22 13:59:34 -0700333 ALOGE("%s(): getMmapPosition() returned status %d", __func__, status);
Phil Burk39f02dd2017-08-04 09:13:31 -0700334 } else {
335 // Convert 32-bit position to 64-bit position.
336 mFramesTransferred.update32(position.position_frames);
337 *positionFrames = mFramesTransferred.get();
338 *timeNanos = position.time_nanoseconds;
339 }
340 return result;
341}
342
343aaudio_result_t AAudioServiceEndpointMMAP::getTimestamp(int64_t *positionFrames,
344 int64_t *timeNanos) {
345 return 0; // TODO
346}
347
Phil Burkbbd52862018-04-13 11:37:42 -0700348// This is called by AudioFlinger when it wants to destroy a stream.
349void AAudioServiceEndpointMMAP::onTearDown(audio_port_handle_t portHandle) {
350 ALOGD("%s(portHandle = %d) called", __func__, portHandle);
351 // Are we tearing down the EXCLUSIVE MMAP stream?
352 if (isStreamRegistered(portHandle)) {
353 ALOGD("%s(%d) tearing down this entire MMAP endpoint", __func__, portHandle);
354 disconnectRegisteredStreams();
355 } else {
356 // Must be a SHARED stream?
357 ALOGD("%s(%d) disconnect a specific stream", __func__, portHandle);
358 aaudio_result_t result = mAAudioService.disconnectStreamByPortHandle(portHandle);
359 ALOGD("%s(%d) disconnectStreamByPortHandle returned %d", __func__, portHandle, result);
360 }
Phil Burk39f02dd2017-08-04 09:13:31 -0700361};
362
363void AAudioServiceEndpointMMAP::onVolumeChanged(audio_channel_mask_t channels,
364 android::Vector<float> values) {
Phil Burk19e990e2018-03-22 13:59:34 -0700365 // TODO Do we really need a different volume for each channel?
366 // We get called with an array filled with a single value!
Phil Burk39f02dd2017-08-04 09:13:31 -0700367 float volume = values[0];
Phil Burk29ccc292019-04-15 08:58:08 -0700368 ALOGD("%s() volume[0] = %f", __func__, volume);
Phil Burk39f02dd2017-08-04 09:13:31 -0700369 std::lock_guard<std::mutex> lock(mLockStreams);
Chih-Hung Hsieh3ef324d2018-12-11 11:48:12 -0800370 for(const auto& stream : mRegisteredStreams) {
Phil Burk39f02dd2017-08-04 09:13:31 -0700371 stream->onVolumeChanged(volume);
372 }
373};
374
375void AAudioServiceEndpointMMAP::onRoutingChanged(audio_port_handle_t deviceId) {
Phil Burk29ccc292019-04-15 08:58:08 -0700376 ALOGD("%s() called with dev %d, old = %d", __func__, deviceId, getDeviceId());
Phil Burk39f02dd2017-08-04 09:13:31 -0700377 if (getDeviceId() != AUDIO_PORT_HANDLE_NONE && getDeviceId() != deviceId) {
378 disconnectRegisteredStreams();
379 }
380 setDeviceId(deviceId);
381};
382
383/**
384 * Get an immutable description of the data queue from the HAL.
385 */
386aaudio_result_t AAudioServiceEndpointMMAP::getDownDataDescription(AudioEndpointParcelable &parcelable)
387{
388 // Gather information on the data queue based on HAL info.
389 int32_t bytesPerFrame = calculateBytesPerFrame();
390 int32_t capacityInBytes = getBufferCapacity() * bytesPerFrame;
391 int fdIndex = parcelable.addFileDescriptor(mAudioDataFileDescriptor, capacityInBytes);
392 parcelable.mDownDataQueueParcelable.setupMemory(fdIndex, 0, capacityInBytes);
393 parcelable.mDownDataQueueParcelable.setBytesPerFrame(bytesPerFrame);
394 parcelable.mDownDataQueueParcelable.setFramesPerBurst(mFramesPerBurst);
395 parcelable.mDownDataQueueParcelable.setCapacityInFrames(getBufferCapacity());
396 return AAUDIO_OK;
397}