Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 "AudioEndpoint" |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 18 | //#define LOG_NDEBUG 0 |
| 19 | #include <utils/Log.h> |
| 20 | |
| 21 | #include <cassert> |
Phil Burk | e4d7bb4 | 2017-03-28 11:32:39 -0700 | [diff] [blame] | 22 | #include <aaudio/AAudio.h> |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 23 | |
| 24 | #include "AudioEndpointParcelable.h" |
| 25 | #include "AudioEndpoint.h" |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 26 | #include "AAudioServiceMessage.h" |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 27 | |
| 28 | using namespace android; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 29 | using namespace aaudio; |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 30 | |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 31 | #define RIDICULOUSLY_LARGE_BUFFER_CAPACITY (256 * 1024) |
| 32 | #define RIDICULOUSLY_LARGE_FRAME_SIZE 4096 |
| 33 | |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 34 | // TODO Consider moving to a method in RingBufferDescriptor |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 35 | static aaudio_result_t AudioEndpoint_validateQueueDescriptor(const char *type, |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 36 | const RingBufferDescriptor *descriptor) { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 37 | if (descriptor == nullptr) { |
| 38 | ALOGE("AudioEndpoint_validateQueueDescriptor() NULL descriptor"); |
| 39 | return AAUDIO_ERROR_NULL; |
| 40 | } |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 41 | |
| 42 | if (descriptor->capacityInFrames < 1 |
| 43 | || descriptor->capacityInFrames > RIDICULOUSLY_LARGE_BUFFER_CAPACITY) { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 44 | ALOGE("AudioEndpoint_validateQueueDescriptor() bad capacityInFrames = %d", |
| 45 | descriptor->capacityInFrames); |
| 46 | return AAUDIO_ERROR_OUT_OF_RANGE; |
| 47 | } |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 48 | |
| 49 | // Reject extreme values to catch bugs and prevent numeric overflows. |
| 50 | if (descriptor->bytesPerFrame < 1 |
| 51 | || descriptor->bytesPerFrame > RIDICULOUSLY_LARGE_FRAME_SIZE) { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 52 | ALOGE("AudioEndpoint_validateQueueDescriptor() bad bytesPerFrame = %d", |
| 53 | descriptor->bytesPerFrame); |
| 54 | return AAUDIO_ERROR_OUT_OF_RANGE; |
| 55 | } |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 56 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 57 | if (descriptor->dataAddress == nullptr) { |
| 58 | ALOGE("AudioEndpoint_validateQueueDescriptor() NULL dataAddress"); |
| 59 | return AAUDIO_ERROR_NULL; |
| 60 | } |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 61 | ALOGV("AudioEndpoint_validateQueueDescriptor %s, dataAddress at %p ====================", |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 62 | type, |
| 63 | descriptor->dataAddress); |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 64 | ALOGV("AudioEndpoint_validateQueueDescriptor readCounter at %p, writeCounter at %p", |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 65 | descriptor->readCounterAddress, |
| 66 | descriptor->writeCounterAddress); |
| 67 | |
| 68 | // Try to READ from the data area. |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 69 | // This code will crash if the mmap failed. |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 70 | uint8_t value = descriptor->dataAddress[0]; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 71 | ALOGV("AudioEndpoint_validateQueueDescriptor() dataAddress[0] = %d, then try to write", |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 72 | (int) value); |
| 73 | // Try to WRITE to the data area. |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 74 | descriptor->dataAddress[0] = value * 3; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 75 | ALOGV("AudioEndpoint_validateQueueDescriptor() wrote successfully"); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 76 | |
| 77 | if (descriptor->readCounterAddress) { |
| 78 | fifo_counter_t counter = *descriptor->readCounterAddress; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 79 | ALOGV("AudioEndpoint_validateQueueDescriptor() *readCounterAddress = %d, now write", |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 80 | (int) counter); |
| 81 | *descriptor->readCounterAddress = counter; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 82 | ALOGV("AudioEndpoint_validateQueueDescriptor() wrote readCounterAddress successfully"); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 83 | } |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 84 | |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 85 | if (descriptor->writeCounterAddress) { |
| 86 | fifo_counter_t counter = *descriptor->writeCounterAddress; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 87 | ALOGV("AudioEndpoint_validateQueueDescriptor() *writeCounterAddress = %d, now write", |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 88 | (int) counter); |
| 89 | *descriptor->writeCounterAddress = counter; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 90 | ALOGV("AudioEndpoint_validateQueueDescriptor() wrote writeCounterAddress successfully"); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 91 | } |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 92 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 93 | return AAUDIO_OK; |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 96 | aaudio_result_t AudioEndpoint_validateDescriptor(const EndpointDescriptor *pEndpointDescriptor) { |
| 97 | aaudio_result_t result = AudioEndpoint_validateQueueDescriptor("messages", |
| 98 | &pEndpointDescriptor->upMessageQueueDescriptor); |
| 99 | if (result == AAUDIO_OK) { |
| 100 | result = AudioEndpoint_validateQueueDescriptor("data", |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 101 | &pEndpointDescriptor->dataQueueDescriptor); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 102 | } |
| 103 | return result; |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 104 | } |
| 105 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 106 | aaudio_result_t AudioEndpoint::configure(const EndpointDescriptor *pEndpointDescriptor, |
| 107 | aaudio_direction_t direction) |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 108 | { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 109 | aaudio_result_t result = AudioEndpoint_validateDescriptor(pEndpointDescriptor); |
| 110 | if (result != AAUDIO_OK) { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 111 | return result; |
| 112 | } |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 113 | |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 114 | // ============================ up message queue ============================= |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 115 | const RingBufferDescriptor *descriptor = &pEndpointDescriptor->upMessageQueueDescriptor; |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 116 | if(descriptor->bytesPerFrame != sizeof(AAudioServiceMessage)) { |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 117 | ALOGE("configure() bytesPerFrame != sizeof(AAudioServiceMessage) = %d", |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 118 | descriptor->bytesPerFrame); |
| 119 | return AAUDIO_ERROR_INTERNAL; |
| 120 | } |
| 121 | |
| 122 | if(descriptor->readCounterAddress == nullptr || descriptor->writeCounterAddress == nullptr) { |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 123 | ALOGE("configure() NULL counter address"); |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 124 | return AAUDIO_ERROR_NULL; |
| 125 | } |
| 126 | |
Phil Burk | 99306c8 | 2017-08-14 12:38:58 -0700 | [diff] [blame] | 127 | // Prevent memory leak and reuse. |
| 128 | if(mUpCommandQueue != nullptr || mDataQueue != nullptr) { |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 129 | ALOGE("configure() endpoint already used"); |
Phil Burk | 99306c8 | 2017-08-14 12:38:58 -0700 | [diff] [blame] | 130 | return AAUDIO_ERROR_INTERNAL; |
| 131 | } |
| 132 | |
Phil Burk | 8f4fe50 | 2020-07-15 23:54:50 +0000 | [diff] [blame] | 133 | mUpCommandQueue = std::make_unique<FifoBufferIndirect>( |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 134 | descriptor->bytesPerFrame, |
| 135 | descriptor->capacityInFrames, |
| 136 | descriptor->readCounterAddress, |
| 137 | descriptor->writeCounterAddress, |
| 138 | descriptor->dataAddress |
| 139 | ); |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 140 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 141 | // ============================ data queue ============================= |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 142 | descriptor = &pEndpointDescriptor->dataQueueDescriptor; |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 143 | ALOGV("configure() data framesPerBurst = %d", descriptor->framesPerBurst); |
| 144 | ALOGV("configure() data readCounterAddress = %p", |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 145 | descriptor->readCounterAddress); |
| 146 | |
| 147 | // An example of free running is when the other side is read or written by hardware DMA |
| 148 | // or a DSP. It does not update its counter so we have to update it. |
| 149 | int64_t *remoteCounter = (direction == AAUDIO_DIRECTION_OUTPUT) |
| 150 | ? descriptor->readCounterAddress // read by other side |
| 151 | : descriptor->writeCounterAddress; // written by other side |
| 152 | mFreeRunning = (remoteCounter == nullptr); |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 153 | ALOGV("configure() mFreeRunning = %d", mFreeRunning ? 1 : 0); |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 154 | |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 155 | int64_t *readCounterAddress = (descriptor->readCounterAddress == nullptr) |
| 156 | ? &mDataReadCounter |
| 157 | : descriptor->readCounterAddress; |
| 158 | int64_t *writeCounterAddress = (descriptor->writeCounterAddress == nullptr) |
| 159 | ? &mDataWriteCounter |
| 160 | : descriptor->writeCounterAddress; |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 161 | |
Phil Burk | eddcf36 | 2021-05-20 23:22:09 +0000 | [diff] [blame] | 162 | // Clear buffer to avoid an initial glitch on some devices. |
| 163 | size_t bufferSizeBytes = descriptor->capacityInFrames * descriptor->bytesPerFrame; |
| 164 | memset(descriptor->dataAddress, 0, bufferSizeBytes); |
| 165 | |
Phil Burk | 8f4fe50 | 2020-07-15 23:54:50 +0000 | [diff] [blame] | 166 | mDataQueue = std::make_unique<FifoBufferIndirect>( |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 167 | descriptor->bytesPerFrame, |
| 168 | descriptor->capacityInFrames, |
| 169 | readCounterAddress, |
| 170 | writeCounterAddress, |
| 171 | descriptor->dataAddress |
| 172 | ); |
| 173 | uint32_t threshold = descriptor->capacityInFrames / 2; |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 174 | mDataQueue->setThreshold(threshold); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 175 | return result; |
| 176 | } |
| 177 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 178 | aaudio_result_t AudioEndpoint::readUpCommand(AAudioServiceMessage *commandPtr) |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 179 | { |
| 180 | return mUpCommandQueue->read(commandPtr, 1); |
| 181 | } |
| 182 | |
Phil Burk | fd34a93 | 2017-07-19 07:03:52 -0700 | [diff] [blame] | 183 | int32_t AudioEndpoint::getEmptyFramesAvailable(WrappingBuffer *wrappingBuffer) { |
| 184 | return mDataQueue->getEmptyRoomAvailable(wrappingBuffer); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 185 | } |
| 186 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 187 | int32_t AudioEndpoint::getEmptyFramesAvailable() { |
Phil Burk | 882c520 | 2018-04-23 10:32:45 -0700 | [diff] [blame] | 188 | return mDataQueue->getEmptyFramesAvailable(); |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 189 | } |
| 190 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 191 | int32_t AudioEndpoint::getFullFramesAvailable(WrappingBuffer *wrappingBuffer) { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 192 | return mDataQueue->getFullDataAvailable(wrappingBuffer); |
Phil Burk | 4485d41 | 2017-05-09 15:55:02 -0700 | [diff] [blame] | 193 | } |
| 194 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 195 | int32_t AudioEndpoint::getFullFramesAvailable() { |
Phil Burk | 882c520 | 2018-04-23 10:32:45 -0700 | [diff] [blame] | 196 | return mDataQueue->getFullFramesAvailable(); |
Phil Burk | 4485d41 | 2017-05-09 15:55:02 -0700 | [diff] [blame] | 197 | } |
| 198 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 199 | void AudioEndpoint::advanceWriteIndex(int32_t deltaFrames) { |
Phil Burk | 882c520 | 2018-04-23 10:32:45 -0700 | [diff] [blame] | 200 | mDataQueue->advanceWriteIndex(deltaFrames); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 201 | } |
| 202 | |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 203 | void AudioEndpoint::advanceReadIndex(int32_t deltaFrames) { |
Phil Burk | 882c520 | 2018-04-23 10:32:45 -0700 | [diff] [blame] | 204 | mDataQueue->advanceReadIndex(deltaFrames); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 205 | } |
| 206 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 207 | void AudioEndpoint::setDataReadCounter(fifo_counter_t framesRead) { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 208 | mDataQueue->setReadCounter(framesRead); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 209 | } |
| 210 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 211 | fifo_counter_t AudioEndpoint::getDataReadCounter() const { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 212 | return mDataQueue->getReadCounter(); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 213 | } |
| 214 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 215 | void AudioEndpoint::setDataWriteCounter(fifo_counter_t framesRead) { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 216 | mDataQueue->setWriteCounter(framesRead); |
| 217 | } |
| 218 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 219 | fifo_counter_t AudioEndpoint::getDataWriteCounter() const { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 220 | return mDataQueue->getWriteCounter(); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 221 | } |
| 222 | |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 223 | int32_t AudioEndpoint::setBufferSizeInFrames(int32_t requestedFrames, |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 224 | int32_t *actualFrames) { |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 225 | if (requestedFrames < ENDPOINT_DATA_QUEUE_SIZE_MIN) { |
| 226 | requestedFrames = ENDPOINT_DATA_QUEUE_SIZE_MIN; |
| 227 | } |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 228 | mDataQueue->setThreshold(requestedFrames); |
| 229 | *actualFrames = mDataQueue->getThreshold(); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 230 | return AAUDIO_OK; |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 231 | } |
| 232 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 233 | int32_t AudioEndpoint::getBufferSizeInFrames() const { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 234 | return mDataQueue->getThreshold(); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 235 | } |
| 236 | |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 237 | int32_t AudioEndpoint::getBufferCapacityInFrames() const { |
Phil Burk | 87c9f64 | 2017-05-17 07:22:39 -0700 | [diff] [blame] | 238 | return (int32_t)mDataQueue->getBufferCapacityInFrames(); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 239 | } |
| 240 | |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 241 | void AudioEndpoint::dump() const { |
Phil Burk | 5edc4ea | 2020-04-17 08:15:42 -0700 | [diff] [blame] | 242 | ALOGD("data readCounter = %lld", (long long) getDataReadCounter()); |
| 243 | ALOGD("data writeCounter = %lld", (long long) getDataWriteCounter()); |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 244 | } |
Phil Burk | ea04d97 | 2017-08-07 12:30:44 -0700 | [diff] [blame] | 245 | |
| 246 | void AudioEndpoint::eraseDataMemory() { |
| 247 | mDataQueue->eraseMemory(); |
| 248 | } |