The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 | #ifndef ANDROID_AUDIO_TRACK_SHARED_H |
| 18 | #define ANDROID_AUDIO_TRACK_SHARED_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Glenn Kasten | c56f342 | 2014-03-21 17:53:17 -0700 | [diff] [blame] | 23 | #include <audio_utils/minifloat.h> |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | #include <utils/threads.h> |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 25 | #include <utils/Log.h> |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 26 | #include <utils/RefBase.h> |
Glenn Kasten | 53dbe77 | 2015-01-06 10:46:38 -0800 | [diff] [blame] | 27 | #include <audio_utils/roundup.h> |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 28 | #include <media/AudioResamplerPublic.h> |
Andy Hung | 90e8a97 | 2015-11-09 16:42:40 -0800 | [diff] [blame^] | 29 | #include <media/Modulo.h> |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 30 | #include <media/SingleStateQueue.h> |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | |
| 32 | namespace android { |
| 33 | |
| 34 | // ---------------------------------------------------------------------------- |
| 35 | |
Glenn Kasten | 96f60d8 | 2013-07-12 10:21:18 -0700 | [diff] [blame] | 36 | // for audio_track_cblk_t::mFlags |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 37 | #define CBLK_UNDERRUN 0x01 // set by server immediately on output underrun, cleared by client |
Glenn Kasten | 864585d | 2012-11-06 16:15:41 -0800 | [diff] [blame] | 38 | #define CBLK_FORCEREADY 0x02 // set: track is considered ready immediately by AudioFlinger, |
Glenn Kasten | 9c5fdd8 | 2012-11-05 13:38:15 -0800 | [diff] [blame] | 39 | // clear: track is ready when buffer full |
Glenn Kasten | 864585d | 2012-11-06 16:15:41 -0800 | [diff] [blame] | 40 | #define CBLK_INVALID 0x04 // track buffer invalidated by AudioFlinger, need to re-create |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 41 | #define CBLK_DISABLED 0x08 // output track disabled by AudioFlinger due to underrun, |
| 42 | // need to re-start. Unlike CBLK_UNDERRUN, this is not set |
| 43 | // immediately, but only after a long string of underruns. |
| 44 | // 0x10 unused |
| 45 | #define CBLK_LOOP_CYCLE 0x20 // set by server each time a loop cycle other than final one completes |
| 46 | #define CBLK_LOOP_FINAL 0x40 // set by server when the final loop cycle completes |
| 47 | #define CBLK_BUFFER_END 0x80 // set by server when the position reaches end of buffer if not looping |
| 48 | #define CBLK_OVERRUN 0x100 // set by server immediately on input overrun, cleared by client |
| 49 | #define CBLK_INTERRUPT 0x200 // set by client on interrupt(), cleared by client in obtainBuffer() |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 50 | #define CBLK_STREAM_END_DONE 0x400 // set by server on render completion, cleared by client |
| 51 | |
| 52 | //EL_FIXME 20 seconds may not be enough and must be reconciled with new obtainBuffer implementation |
Glenn Kasten | e198c36 | 2013-08-13 09:13:36 -0700 | [diff] [blame] | 53 | #define MAX_RUN_OFFLOADED_TIMEOUT_MS 20000 // assuming up to a maximum of 20 seconds of offloaded |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 55 | struct AudioTrackSharedStreaming { |
| 56 | // similar to NBAIO MonoPipe |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 57 | // in continuously incrementing frame units, take modulo buffer size, which must be a power of 2 |
Glenn Kasten | f59497b | 2015-01-26 16:35:47 -0800 | [diff] [blame] | 58 | volatile int32_t mFront; // read by consumer (output: server, input: client) |
| 59 | volatile int32_t mRear; // written by producer (output: client, input: server) |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 60 | volatile int32_t mFlush; // incremented by client to indicate a request to flush; |
| 61 | // server notices and discards all data between mFront and mRear |
| 62 | volatile uint32_t mUnderrunFrames; // server increments for each unavailable but desired frame |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 63 | }; |
| 64 | |
Andy Hung | 9b46158 | 2014-12-01 17:56:29 -0800 | [diff] [blame] | 65 | // Represents a single state of an AudioTrack that was created in static mode (shared memory buffer |
| 66 | // supplied by the client). This state needs to be communicated from the client to server. As this |
| 67 | // state is too large to be updated atomically without a mutex, and mutexes aren't allowed here, the |
| 68 | // state is wrapped by a SingleStateQueue. |
| 69 | struct StaticAudioTrackState { |
| 70 | // Do not define constructors, destructors, or virtual methods as this is part of a |
| 71 | // union in shared memory and they will not get called properly. |
| 72 | |
| 73 | // These fields should both be size_t, but since they are located in shared memory we |
| 74 | // force to 32-bit. The client and server may have different typedefs for size_t. |
| 75 | |
| 76 | // The state has a sequence counter to indicate whether changes are made to loop or position. |
| 77 | // The sequence counter also currently indicates whether loop or position is first depending |
| 78 | // on which is greater; it jumps by max(mLoopSequence, mPositionSequence) + 1. |
| 79 | |
| 80 | uint32_t mLoopStart; |
| 81 | uint32_t mLoopEnd; |
| 82 | int32_t mLoopCount; |
| 83 | uint32_t mLoopSequence; // a sequence counter to indicate changes to loop |
| 84 | uint32_t mPosition; |
| 85 | uint32_t mPositionSequence; // a sequence counter to indicate changes to position |
| 86 | }; |
| 87 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 88 | typedef SingleStateQueue<StaticAudioTrackState> StaticAudioTrackSingleStateQueue; |
| 89 | |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 90 | struct StaticAudioTrackPosLoop { |
| 91 | // Do not define constructors, destructors, or virtual methods as this is part of a |
| 92 | // union in shared memory and will not get called properly. |
| 93 | |
| 94 | // These fields should both be size_t, but since they are located in shared memory we |
| 95 | // force to 32-bit. The client and server may have different typedefs for size_t. |
| 96 | |
| 97 | // This struct information is stored in a single state queue to communicate the |
| 98 | // static AudioTrack server state to the client while data is consumed. |
| 99 | // It is smaller than StaticAudioTrackState to prevent unnecessary information from |
| 100 | // being sent. |
| 101 | |
| 102 | uint32_t mBufferPosition; |
| 103 | int32_t mLoopCount; |
| 104 | }; |
| 105 | |
| 106 | typedef SingleStateQueue<StaticAudioTrackPosLoop> StaticAudioTrackPosLoopQueue; |
| 107 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 108 | struct AudioTrackSharedStatic { |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 109 | // client requests to the server for loop or position changes. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 110 | StaticAudioTrackSingleStateQueue::Shared |
| 111 | mSingleStateQueue; |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 112 | // position info updated asynchronously by server and read by client, |
| 113 | // "for entertainment purposes only" |
| 114 | StaticAudioTrackPosLoopQueue::Shared |
| 115 | mPosLoopQueue; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 116 | }; |
| 117 | |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 118 | typedef SingleStateQueue<AudioPlaybackRate> PlaybackRateQueue; |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 119 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 120 | // ---------------------------------------------------------------------------- |
| 121 | |
Glenn Kasten | 1a0ae5b | 2012-02-03 10:24:48 -0800 | [diff] [blame] | 122 | // Important: do not add any virtual methods, including ~ |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 123 | struct audio_track_cblk_t |
| 124 | { |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 125 | // Since the control block is always located in shared memory, this constructor |
| 126 | // is only used for placement new(). It is never used for regular new() or stack. |
| 127 | audio_track_cblk_t(); |
| 128 | /*virtual*/ ~audio_track_cblk_t() { } |
| 129 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 130 | friend class Proxy; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 131 | friend class ClientProxy; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 132 | friend class AudioTrackClientProxy; |
| 133 | friend class AudioRecordClientProxy; |
| 134 | friend class ServerProxy; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 135 | friend class AudioTrackServerProxy; |
| 136 | friend class AudioRecordServerProxy; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | |
| 138 | // The data members are grouped so that members accessed frequently and in the same context |
| 139 | // are in the same line of data cache. |
Glenn Kasten | 99e53b8 | 2012-01-19 08:59:58 -0800 | [diff] [blame] | 140 | |
Glenn Kasten | f20e1d8 | 2013-07-12 09:45:18 -0700 | [diff] [blame] | 141 | uint32_t mServer; // Number of filled frames consumed by server (mIsOut), |
| 142 | // or filled frames provided by server (!mIsOut). |
| 143 | // It is updated asynchronously by server without a barrier. |
Glenn Kasten | b187de1 | 2014-12-30 08:18:15 -0800 | [diff] [blame] | 144 | // The value should be used |
| 145 | // "for entertainment purposes only", |
Glenn Kasten | f20e1d8 | 2013-07-12 09:45:18 -0700 | [diff] [blame] | 146 | // which means don't make important decisions based on it. |
Glenn Kasten | 22eb4e2 | 2012-11-07 14:03:00 -0800 | [diff] [blame] | 147 | |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 148 | uint32_t mPad1; // unused |
Glenn Kasten | 99e53b8 | 2012-01-19 08:59:58 -0800 | [diff] [blame] | 149 | |
Glenn Kasten | 0d09a9b | 2013-06-24 12:06:46 -0700 | [diff] [blame] | 150 | volatile int32_t mFutex; // event flag: down (P) by client, |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 151 | // up (V) by server or binderDied() or interrupt() |
Glenn Kasten | 0d09a9b | 2013-06-24 12:06:46 -0700 | [diff] [blame] | 152 | #define CBLK_FUTEX_WAKE 1 // if event flag bit is set, then a deferred wake is pending |
Glenn Kasten | 99e53b8 | 2012-01-19 08:59:58 -0800 | [diff] [blame] | 153 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 154 | private: |
| 155 | |
Glenn Kasten | fdac7c0 | 2014-01-28 11:03:28 -0800 | [diff] [blame] | 156 | // This field should be a size_t, but since it is located in shared memory we |
| 157 | // force to 32-bit. The client and server may have different typedefs for size_t. |
| 158 | uint32_t mMinimum; // server wakes up client if available >= mMinimum |
Glenn Kasten | b1cf75c | 2012-01-17 12:20:54 -0800 | [diff] [blame] | 159 | |
Glenn Kasten | c56f342 | 2014-03-21 17:53:17 -0700 | [diff] [blame] | 160 | // Stereo gains for AudioTrack only, not used by AudioRecord. |
| 161 | gain_minifloat_packed_t mVolumeLR; |
Glenn Kasten | b1cf75c | 2012-01-17 12:20:54 -0800 | [diff] [blame] | 162 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 163 | uint32_t mSampleRate; // AudioTrack only: client's requested sample rate in Hz |
| 164 | // or 0 == default. Write-only client, read-only server. |
Glenn Kasten | 99e53b8 | 2012-01-19 08:59:58 -0800 | [diff] [blame] | 165 | |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 166 | PlaybackRateQueue::Shared mPlaybackRateQueue; |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 167 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 168 | // client write-only, server read-only |
| 169 | uint16_t mSendLevel; // Fixed point U4.12 so 0x1000 means 1.0 |
| 170 | |
Glenn Kasten | d054c32 | 2013-07-12 12:59:20 -0700 | [diff] [blame] | 171 | uint16_t mPad2; // unused |
Eric Laurent | d1b449a | 2010-05-14 03:26:45 -0700 | [diff] [blame] | 172 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 173 | public: |
Glenn Kasten | 99e53b8 | 2012-01-19 08:59:58 -0800 | [diff] [blame] | 174 | |
Glenn Kasten | 96f60d8 | 2013-07-12 10:21:18 -0700 | [diff] [blame] | 175 | volatile int32_t mFlags; // combinations of CBLK_* |
Eric Laurent | 38ccae2 | 2011-03-28 18:37:07 -0700 | [diff] [blame] | 176 | |
Eric Laurent | d1b449a | 2010-05-14 03:26:45 -0700 | [diff] [blame] | 177 | // Cache line boundary (32 bytes) |
Jean-Michel Trivi | 0d255b2 | 2011-05-24 15:53:33 -0700 | [diff] [blame] | 178 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 179 | public: |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 180 | union { |
| 181 | AudioTrackSharedStreaming mStreaming; |
| 182 | AudioTrackSharedStatic mStatic; |
| 183 | int mAlign[8]; |
| 184 | } u; |
| 185 | |
| 186 | // Cache line boundary (32 bytes) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | }; |
| 188 | |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 189 | // ---------------------------------------------------------------------------- |
| 190 | |
| 191 | // Proxy for shared memory control block, to isolate callers from needing to know the details. |
| 192 | // There is exactly one ClientProxy and one ServerProxy per shared memory control block. |
| 193 | // The proxies are located in normal memory, and are not multi-thread safe within a given side. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 194 | class Proxy : public RefBase { |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 195 | protected: |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 196 | Proxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, size_t frameSize, bool isOut, |
| 197 | bool clientInServer); |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 198 | virtual ~Proxy() { } |
| 199 | |
| 200 | public: |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 201 | struct Buffer { |
| 202 | size_t mFrameCount; // number of frames available in this buffer |
| 203 | void* mRaw; // pointer to first frame |
| 204 | size_t mNonContig; // number of additional non-contiguous frames available |
| 205 | }; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 206 | |
| 207 | protected: |
| 208 | // These refer to shared memory, and are virtual addresses with respect to the current process. |
| 209 | // They may have different virtual addresses within the other process. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 210 | audio_track_cblk_t* const mCblk; // the control block |
| 211 | void* const mBuffers; // starting address of buffers |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 212 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 213 | const size_t mFrameCount; // not necessarily a power of 2 |
| 214 | const size_t mFrameSize; // in bytes |
| 215 | const size_t mFrameCountP2; // mFrameCount rounded to power of 2, streaming mode |
| 216 | const bool mIsOut; // true for AudioTrack, false for AudioRecord |
| 217 | const bool mClientInServer; // true for OutputTrack, false for AudioTrack & AudioRecord |
| 218 | bool mIsShutdown; // latch set to true when shared memory corruption detected |
Glenn Kasten | 7db7df0 | 2013-06-25 16:13:23 -0700 | [diff] [blame] | 219 | size_t mUnreleased; // unreleased frames remaining from most recent obtainBuffer |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | // ---------------------------------------------------------------------------- |
| 223 | |
| 224 | // Proxy seen by AudioTrack client and AudioRecord client |
| 225 | class ClientProxy : public Proxy { |
Eric Laurent | 83b8808 | 2014-06-20 18:31:16 -0700 | [diff] [blame] | 226 | public: |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 227 | ClientProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, size_t frameSize, |
| 228 | bool isOut, bool clientInServer); |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 229 | virtual ~ClientProxy() { } |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 230 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 231 | static const struct timespec kForever; |
| 232 | static const struct timespec kNonBlocking; |
| 233 | |
| 234 | // Obtain a buffer with filled frames (reading) or empty frames (writing). |
| 235 | // It is permitted to call obtainBuffer() multiple times in succession, without any intervening |
| 236 | // calls to releaseBuffer(). In that case, the final obtainBuffer() is the one that effectively |
| 237 | // sets or extends the unreleased frame count. |
| 238 | // On entry: |
| 239 | // buffer->mFrameCount should be initialized to maximum number of desired frames, |
| 240 | // which must be > 0. |
| 241 | // buffer->mNonContig is unused. |
| 242 | // buffer->mRaw is unused. |
| 243 | // requested is the requested timeout in local monotonic delta time units: |
| 244 | // NULL or &kNonBlocking means non-blocking (zero timeout). |
| 245 | // &kForever means block forever (infinite timeout). |
| 246 | // Other values mean a specific timeout in local monotonic delta time units. |
| 247 | // elapsed is a pointer to a location that will hold the total local monotonic time that |
| 248 | // elapsed while blocked, or NULL if not needed. |
| 249 | // On exit: |
| 250 | // buffer->mFrameCount has the actual number of contiguous available frames, |
| 251 | // which is always 0 when the return status != NO_ERROR. |
| 252 | // buffer->mNonContig is the number of additional non-contiguous available frames. |
| 253 | // buffer->mRaw is a pointer to the first available frame, |
| 254 | // or NULL when buffer->mFrameCount == 0. |
| 255 | // The return status is one of: |
| 256 | // NO_ERROR Success, buffer->mFrameCount > 0. |
| 257 | // WOULD_BLOCK Non-blocking mode and no frames are available. |
| 258 | // TIMED_OUT Timeout occurred before any frames became available. |
| 259 | // This can happen even for infinite timeout, due to a spurious wakeup. |
| 260 | // In this case, the caller should investigate and then re-try as appropriate. |
| 261 | // DEAD_OBJECT Server has died or invalidated, caller should destroy this proxy and re-create. |
| 262 | // -EINTR Call has been interrupted. Look around to see why, and then perhaps try again. |
| 263 | // NO_INIT Shared memory is corrupt. |
Glenn Kasten | 7db7df0 | 2013-06-25 16:13:23 -0700 | [diff] [blame] | 264 | // Assertion failure on entry, if buffer == NULL or buffer->mFrameCount == 0. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 265 | status_t obtainBuffer(Buffer* buffer, const struct timespec *requested = NULL, |
| 266 | struct timespec *elapsed = NULL); |
| 267 | |
| 268 | // Release (some of) the frames last obtained. |
| 269 | // On entry, buffer->mFrameCount should have the number of frames to release, |
| 270 | // which must (cumulatively) be <= the number of frames last obtained but not yet released. |
| 271 | // buffer->mRaw is ignored, but is normally same pointer returned by last obtainBuffer(). |
| 272 | // It is permitted to call releaseBuffer() multiple times to release the frames in chunks. |
| 273 | // On exit: |
| 274 | // buffer->mFrameCount is zero. |
| 275 | // buffer->mRaw is NULL. |
| 276 | void releaseBuffer(Buffer* buffer); |
| 277 | |
| 278 | // Call after detecting server's death |
| 279 | void binderDied(); |
| 280 | |
| 281 | // Call to force an obtainBuffer() to return quickly with -EINTR |
| 282 | void interrupt(); |
| 283 | |
Andy Hung | 90e8a97 | 2015-11-09 16:42:40 -0800 | [diff] [blame^] | 284 | Modulo<uint32_t> getPosition() { |
Glenn Kasten | f20e1d8 | 2013-07-12 09:45:18 -0700 | [diff] [blame] | 285 | return mEpoch + mCblk->mServer; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 286 | } |
| 287 | |
Andy Hung | 90e8a97 | 2015-11-09 16:42:40 -0800 | [diff] [blame^] | 288 | void setEpoch(const Modulo<uint32_t> &epoch) { |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 289 | mEpoch = epoch; |
| 290 | } |
| 291 | |
| 292 | void setMinimum(size_t minimum) { |
Glenn Kasten | fdac7c0 | 2014-01-28 11:03:28 -0800 | [diff] [blame] | 293 | // This can only happen on a 64-bit client |
| 294 | if (minimum > UINT32_MAX) { |
| 295 | minimum = UINT32_MAX; |
| 296 | } |
| 297 | mCblk->mMinimum = (uint32_t) minimum; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | // Return the number of frames that would need to be obtained and released |
| 301 | // in order for the client to be aligned at start of buffer |
| 302 | virtual size_t getMisalignment(); |
| 303 | |
Andy Hung | 90e8a97 | 2015-11-09 16:42:40 -0800 | [diff] [blame^] | 304 | Modulo<uint32_t> getEpoch() const { |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 305 | return mEpoch; |
| 306 | } |
| 307 | |
Eric Laurent | cc21e4f | 2013-10-16 15:12:32 -0700 | [diff] [blame] | 308 | size_t getFramesFilled(); |
| 309 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 310 | private: |
Andy Hung | 90e8a97 | 2015-11-09 16:42:40 -0800 | [diff] [blame^] | 311 | Modulo<uint32_t> mEpoch; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 312 | }; |
| 313 | |
| 314 | // ---------------------------------------------------------------------------- |
| 315 | |
| 316 | // Proxy used by AudioTrack client, which also includes AudioFlinger::PlaybackThread::OutputTrack |
| 317 | class AudioTrackClientProxy : public ClientProxy { |
| 318 | public: |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 319 | AudioTrackClientProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, |
| 320 | size_t frameSize, bool clientInServer = false) |
| 321 | : ClientProxy(cblk, buffers, frameCount, frameSize, true /*isOut*/, |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 322 | clientInServer), |
| 323 | mPlaybackRateMutator(&cblk->mPlaybackRateQueue) { } |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 324 | virtual ~AudioTrackClientProxy() { } |
| 325 | |
| 326 | // No barriers on the following operations, so the ordering of loads/stores |
| 327 | // with respect to other parameters is UNPREDICTABLE. That's considered safe. |
| 328 | |
| 329 | // caller must limit to 0.0 <= sendLevel <= 1.0 |
| 330 | void setSendLevel(float sendLevel) { |
| 331 | mCblk->mSendLevel = uint16_t(sendLevel * 0x1000); |
| 332 | } |
| 333 | |
Glenn Kasten | c56f342 | 2014-03-21 17:53:17 -0700 | [diff] [blame] | 334 | // set stereo gains |
| 335 | void setVolumeLR(gain_minifloat_packed_t volumeLR) { |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 336 | mCblk->mVolumeLR = volumeLR; |
| 337 | } |
| 338 | |
| 339 | void setSampleRate(uint32_t sampleRate) { |
| 340 | mCblk->mSampleRate = sampleRate; |
| 341 | } |
| 342 | |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 343 | void setPlaybackRate(const AudioPlaybackRate& playbackRate) { |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 344 | mPlaybackRateMutator.push(playbackRate); |
| 345 | } |
| 346 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 347 | virtual void flush(); |
| 348 | |
| 349 | virtual uint32_t getUnderrunFrames() const { |
| 350 | return mCblk->u.mStreaming.mUnderrunFrames; |
| 351 | } |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 352 | |
| 353 | bool clearStreamEndDone(); // and return previous value |
| 354 | |
| 355 | bool getStreamEndDone() const; |
| 356 | |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 357 | status_t waitStreamEndDone(const struct timespec *requested); |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 358 | |
| 359 | private: |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 360 | PlaybackRateQueue::Mutator mPlaybackRateMutator; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 361 | }; |
| 362 | |
| 363 | class StaticAudioTrackClientProxy : public AudioTrackClientProxy { |
| 364 | public: |
| 365 | StaticAudioTrackClientProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, |
| 366 | size_t frameSize); |
| 367 | virtual ~StaticAudioTrackClientProxy() { } |
| 368 | |
| 369 | virtual void flush(); |
| 370 | |
| 371 | #define MIN_LOOP 16 // minimum length of each loop iteration in frames |
Andy Hung | 9b46158 | 2014-12-01 17:56:29 -0800 | [diff] [blame] | 372 | |
| 373 | // setLoop(), setBufferPosition(), and setBufferPositionAndLoop() set the |
| 374 | // static buffer position and looping parameters. These commands are not |
| 375 | // synchronous (they do not wait or block); instead they take effect at the |
| 376 | // next buffer data read from the server side. However, the client side |
| 377 | // getters will read a cached version of the position and loop variables |
| 378 | // until the setting takes effect. |
| 379 | // |
| 380 | // setBufferPositionAndLoop() is equivalent to calling, in order, setLoop() and |
| 381 | // setBufferPosition(). |
| 382 | // |
| 383 | // The functions should not be relied upon to do parameter or state checking. |
| 384 | // That is done at the AudioTrack level. |
| 385 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 386 | void setLoop(size_t loopStart, size_t loopEnd, int loopCount); |
Andy Hung | 9b46158 | 2014-12-01 17:56:29 -0800 | [diff] [blame] | 387 | void setBufferPosition(size_t position); |
| 388 | void setBufferPositionAndLoop(size_t position, size_t loopStart, size_t loopEnd, |
| 389 | int loopCount); |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 390 | size_t getBufferPosition(); |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 391 | // getBufferPositionAndLoopCount() provides the proper snapshot of |
| 392 | // position and loopCount together. |
| 393 | void getBufferPositionAndLoopCount(size_t *position, int *loopCount); |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 394 | |
| 395 | virtual size_t getMisalignment() { |
| 396 | return 0; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 397 | } |
| 398 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 399 | virtual uint32_t getUnderrunFrames() const { |
| 400 | return 0; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 401 | } |
| 402 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 403 | private: |
| 404 | StaticAudioTrackSingleStateQueue::Mutator mMutator; |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 405 | StaticAudioTrackPosLoopQueue::Observer mPosLoopObserver; |
Andy Hung | 9b46158 | 2014-12-01 17:56:29 -0800 | [diff] [blame] | 406 | StaticAudioTrackState mState; // last communicated state to server |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 407 | StaticAudioTrackPosLoop mPosLoop; // snapshot of position and loop. |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 408 | }; |
| 409 | |
| 410 | // ---------------------------------------------------------------------------- |
| 411 | |
| 412 | // Proxy used by AudioRecord client |
| 413 | class AudioRecordClientProxy : public ClientProxy { |
| 414 | public: |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 415 | AudioRecordClientProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, |
| 416 | size_t frameSize) |
| 417 | : ClientProxy(cblk, buffers, frameCount, frameSize, |
| 418 | false /*isOut*/, false /*clientInServer*/) { } |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 419 | ~AudioRecordClientProxy() { } |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 420 | }; |
| 421 | |
| 422 | // ---------------------------------------------------------------------------- |
| 423 | |
| 424 | // Proxy used by AudioFlinger server |
| 425 | class ServerProxy : public Proxy { |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 426 | protected: |
| 427 | ServerProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, size_t frameSize, |
| 428 | bool isOut, bool clientInServer); |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 429 | public: |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 430 | virtual ~ServerProxy() { } |
| 431 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 432 | // Obtain a buffer with filled frames (writing) or empty frames (reading). |
| 433 | // It is permitted to call obtainBuffer() multiple times in succession, without any intervening |
| 434 | // calls to releaseBuffer(). In that case, the final obtainBuffer() is the one that effectively |
| 435 | // sets or extends the unreleased frame count. |
| 436 | // Always non-blocking. |
| 437 | // On entry: |
| 438 | // buffer->mFrameCount should be initialized to maximum number of desired frames, |
| 439 | // which must be > 0. |
| 440 | // buffer->mNonContig is unused. |
| 441 | // buffer->mRaw is unused. |
Glenn Kasten | 2e422c4 | 2013-10-18 13:00:29 -0700 | [diff] [blame] | 442 | // ackFlush is true iff being called from Track::start to acknowledge a pending flush. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 443 | // On exit: |
| 444 | // buffer->mFrameCount has the actual number of contiguous available frames, |
| 445 | // which is always 0 when the return status != NO_ERROR. |
| 446 | // buffer->mNonContig is the number of additional non-contiguous available frames. |
| 447 | // buffer->mRaw is a pointer to the first available frame, |
| 448 | // or NULL when buffer->mFrameCount == 0. |
| 449 | // The return status is one of: |
| 450 | // NO_ERROR Success, buffer->mFrameCount > 0. |
| 451 | // WOULD_BLOCK No frames are available. |
| 452 | // NO_INIT Shared memory is corrupt. |
Glenn Kasten | 2e422c4 | 2013-10-18 13:00:29 -0700 | [diff] [blame] | 453 | virtual status_t obtainBuffer(Buffer* buffer, bool ackFlush = false); |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 454 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 455 | // Release (some of) the frames last obtained. |
| 456 | // On entry, buffer->mFrameCount should have the number of frames to release, |
| 457 | // which must (cumulatively) be <= the number of frames last obtained but not yet released. |
| 458 | // It is permitted to call releaseBuffer() multiple times to release the frames in chunks. |
| 459 | // buffer->mRaw is ignored, but is normally same pointer returned by last obtainBuffer(). |
| 460 | // On exit: |
| 461 | // buffer->mFrameCount is zero. |
| 462 | // buffer->mRaw is NULL. |
| 463 | virtual void releaseBuffer(Buffer* buffer); |
| 464 | |
| 465 | protected: |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 466 | size_t mAvailToClient; // estimated frames available to client prior to releaseBuffer() |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 467 | int32_t mFlush; // our copy of cblk->u.mStreaming.mFlush, for streaming output only |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 468 | }; |
| 469 | |
| 470 | // Proxy used by AudioFlinger for servicing AudioTrack |
| 471 | class AudioTrackServerProxy : public ServerProxy { |
| 472 | public: |
| 473 | AudioTrackServerProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, |
Eric Laurent | 83b8808 | 2014-06-20 18:31:16 -0700 | [diff] [blame] | 474 | size_t frameSize, bool clientInServer = false, uint32_t sampleRate = 0) |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 475 | : ServerProxy(cblk, buffers, frameCount, frameSize, true /*isOut*/, clientInServer), |
| 476 | mPlaybackRateObserver(&cblk->mPlaybackRateQueue) { |
Eric Laurent | 83b8808 | 2014-06-20 18:31:16 -0700 | [diff] [blame] | 477 | mCblk->mSampleRate = sampleRate; |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 478 | mPlaybackRate = AUDIO_PLAYBACK_RATE_DEFAULT; |
Eric Laurent | 83b8808 | 2014-06-20 18:31:16 -0700 | [diff] [blame] | 479 | } |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 480 | protected: |
| 481 | virtual ~AudioTrackServerProxy() { } |
| 482 | |
| 483 | public: |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 484 | // return value of these methods must be validated by the caller |
| 485 | uint32_t getSampleRate() const { return mCblk->mSampleRate; } |
| 486 | uint16_t getSendLevel_U4_12() const { return mCblk->mSendLevel; } |
Glenn Kasten | c56f342 | 2014-03-21 17:53:17 -0700 | [diff] [blame] | 487 | gain_minifloat_packed_t getVolumeLR() const { return mCblk->mVolumeLR; } |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 488 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 489 | // estimated total number of filled frames available to server to read, |
| 490 | // which may include non-contiguous frames |
| 491 | virtual size_t framesReady(); |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 492 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 493 | // Currently AudioFlinger will call framesReady() for a fast track from two threads: |
| 494 | // FastMixer thread, and normal mixer thread. This is dangerous, as the proxy is intended |
| 495 | // to be called from at most one thread of server, and one thread of client. |
| 496 | // As a temporary workaround, this method informs the proxy implementation that it |
| 497 | // should avoid doing a state queue poll from within framesReady(). |
| 498 | // FIXME Change AudioFlinger to not call framesReady() from normal mixer thread. |
| 499 | virtual void framesReadyIsCalledByMultipleThreads() { } |
Eric Laurent | bfb1b83 | 2013-01-07 09:53:42 -0800 | [diff] [blame] | 500 | |
| 501 | bool setStreamEndDone(); // and return previous value |
Glenn Kasten | 82aaf94 | 2013-07-17 16:05:07 -0700 | [diff] [blame] | 502 | |
| 503 | // Add to the tally of underrun frames, and inform client of underrun |
| 504 | virtual void tallyUnderrunFrames(uint32_t frameCount); |
| 505 | |
| 506 | // Return the total number of frames which AudioFlinger desired but were unavailable, |
| 507 | // and thus which resulted in an underrun. |
| 508 | virtual uint32_t getUnderrunFrames() const { return mCblk->u.mStreaming.mUnderrunFrames; } |
Glenn Kasten | bd096fd | 2013-08-23 13:53:56 -0700 | [diff] [blame] | 509 | |
| 510 | // Return the total number of frames that AudioFlinger has obtained and released |
| 511 | virtual size_t framesReleased() const { return mCblk->mServer; } |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 512 | |
| 513 | // Return the playback speed and pitch read atomically. Not multi-thread safe on server side. |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 514 | AudioPlaybackRate getPlaybackRate(); |
Andy Hung | 8edb8dc | 2015-03-26 19:13:55 -0700 | [diff] [blame] | 515 | |
| 516 | private: |
Ricardo Garcia | 5a8a95d | 2015-04-18 14:47:04 -0700 | [diff] [blame] | 517 | AudioPlaybackRate mPlaybackRate; // last observed playback rate |
| 518 | PlaybackRateQueue::Observer mPlaybackRateObserver; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 519 | }; |
| 520 | |
| 521 | class StaticAudioTrackServerProxy : public AudioTrackServerProxy { |
| 522 | public: |
| 523 | StaticAudioTrackServerProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, |
| 524 | size_t frameSize); |
| 525 | protected: |
| 526 | virtual ~StaticAudioTrackServerProxy() { } |
| 527 | |
| 528 | public: |
| 529 | virtual size_t framesReady(); |
| 530 | virtual void framesReadyIsCalledByMultipleThreads(); |
Glenn Kasten | 2e422c4 | 2013-10-18 13:00:29 -0700 | [diff] [blame] | 531 | virtual status_t obtainBuffer(Buffer* buffer, bool ackFlush); |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 532 | virtual void releaseBuffer(Buffer* buffer); |
Glenn Kasten | 82aaf94 | 2013-07-17 16:05:07 -0700 | [diff] [blame] | 533 | virtual void tallyUnderrunFrames(uint32_t frameCount); |
| 534 | virtual uint32_t getUnderrunFrames() const { return 0; } |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 535 | |
| 536 | private: |
Andy Hung | 9b46158 | 2014-12-01 17:56:29 -0800 | [diff] [blame] | 537 | status_t updateStateWithLoop(StaticAudioTrackState *localState, |
| 538 | const StaticAudioTrackState &update) const; |
| 539 | status_t updateStateWithPosition(StaticAudioTrackState *localState, |
| 540 | const StaticAudioTrackState &update) const; |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 541 | ssize_t pollPosition(); // poll for state queue update, and return current position |
| 542 | StaticAudioTrackSingleStateQueue::Observer mObserver; |
Andy Hung | 4ede21d | 2014-12-12 15:37:34 -0800 | [diff] [blame] | 543 | StaticAudioTrackPosLoopQueue::Mutator mPosLoopMutator; |
Andy Hung | cb2129b | 2014-11-11 12:17:22 -0800 | [diff] [blame] | 544 | size_t mFramesReadySafe; // Assuming size_t read/writes are atomic on 32 / 64 bit |
| 545 | // processors, this is a thread-safe version of |
| 546 | // mFramesReady. |
| 547 | int64_t mFramesReady; // The number of frames ready in the static buffer |
| 548 | // including loops. This is 64 bits since loop mode |
| 549 | // can cause a track to appear to have a large number |
| 550 | // of frames. INT64_MAX means an infinite loop. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 551 | bool mFramesReadyIsCalledByMultipleThreads; |
Andy Hung | 9b46158 | 2014-12-01 17:56:29 -0800 | [diff] [blame] | 552 | StaticAudioTrackState mState; // Server side state. Any updates from client must be |
| 553 | // passed by the mObserver SingleStateQueue. |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 554 | }; |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 555 | |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 556 | // Proxy used by AudioFlinger for servicing AudioRecord |
| 557 | class AudioRecordServerProxy : public ServerProxy { |
| 558 | public: |
| 559 | AudioRecordServerProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount, |
Eric Laurent | 83b8808 | 2014-06-20 18:31:16 -0700 | [diff] [blame] | 560 | size_t frameSize, bool clientInServer) |
| 561 | : ServerProxy(cblk, buffers, frameCount, frameSize, false /*isOut*/, clientInServer) { } |
Glenn Kasten | 9f80dd2 | 2012-12-18 15:57:32 -0800 | [diff] [blame] | 562 | protected: |
| 563 | virtual ~AudioRecordServerProxy() { } |
Glenn Kasten | e3aa659 | 2012-12-04 12:22:46 -0800 | [diff] [blame] | 564 | }; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 565 | |
| 566 | // ---------------------------------------------------------------------------- |
| 567 | |
| 568 | }; // namespace android |
| 569 | |
| 570 | #endif // ANDROID_AUDIO_TRACK_SHARED_H |