Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 1 | /* |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2 | ** |
| 3 | ** Copyright 2007, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #define LOG_TAG "IAudioFlinger" |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 19 | //#define LOG_NDEBUG 0 |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | #include <utils/Log.h> |
| 21 | |
| 22 | #include <stdint.h> |
| 23 | #include <sys/types.h> |
| 24 | |
Mathias Agopian | 7562408 | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 25 | #include <binder/Parcel.h> |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | |
| 27 | #include <media/IAudioFlinger.h> |
| 28 | |
| 29 | namespace android { |
| 30 | |
| 31 | enum { |
| 32 | CREATE_TRACK = IBinder::FIRST_CALL_TRANSACTION, |
| 33 | OPEN_RECORD, |
| 34 | SAMPLE_RATE, |
Glenn Kasten | 5876f2f | 2012-11-30 10:52:16 -0800 | [diff] [blame] | 35 | RESERVED, // obsolete, was CHANNEL_COUNT |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | FORMAT, |
| 37 | FRAME_COUNT, |
| 38 | LATENCY, |
| 39 | SET_MASTER_VOLUME, |
| 40 | SET_MASTER_MUTE, |
| 41 | MASTER_VOLUME, |
| 42 | MASTER_MUTE, |
| 43 | SET_STREAM_VOLUME, |
| 44 | SET_STREAM_MUTE, |
| 45 | STREAM_VOLUME, |
| 46 | STREAM_MUTE, |
| 47 | SET_MODE, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | SET_MIC_MUTE, |
| 49 | GET_MIC_MUTE, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 50 | SET_PARAMETERS, |
| 51 | GET_PARAMETERS, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | REGISTER_CLIENT, |
| 53 | GET_INPUTBUFFERSIZE, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 54 | OPEN_OUTPUT, |
| 55 | OPEN_DUPLICATE_OUTPUT, |
| 56 | CLOSE_OUTPUT, |
| 57 | SUSPEND_OUTPUT, |
| 58 | RESTORE_OUTPUT, |
| 59 | OPEN_INPUT, |
| 60 | CLOSE_INPUT, |
Glenn Kasten | d2304db | 2014-02-03 07:40:31 -0800 | [diff] [blame] | 61 | INVALIDATE_STREAM, |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 62 | SET_VOICE_VOLUME, |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 63 | GET_RENDER_POSITION, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 64 | GET_INPUT_FRAMES_LOST, |
| 65 | NEW_AUDIO_SESSION_ID, |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 66 | ACQUIRE_AUDIO_SESSION_ID, |
| 67 | RELEASE_AUDIO_SESSION_ID, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 68 | QUERY_NUM_EFFECTS, |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 69 | QUERY_EFFECT, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 70 | GET_EFFECT_DESCRIPTOR, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 71 | CREATE_EFFECT, |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 72 | MOVE_EFFECTS, |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 73 | LOAD_HW_MODULE, |
| 74 | GET_PRIMARY_OUTPUT_SAMPLING_RATE, |
| 75 | GET_PRIMARY_OUTPUT_FRAME_COUNT, |
Glenn Kasten | 4182c4e | 2013-07-15 14:45:07 -0700 | [diff] [blame] | 76 | SET_LOW_RAM_DEVICE, |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 77 | LIST_AUDIO_PORTS, |
| 78 | GET_AUDIO_PORT, |
| 79 | CREATE_AUDIO_PATCH, |
| 80 | RELEASE_AUDIO_PATCH, |
| 81 | LIST_AUDIO_PATCHES, |
Eric Laurent | 93c3d41 | 2014-08-01 14:48:35 -0700 | [diff] [blame] | 82 | SET_AUDIO_PORT_CONFIG, |
| 83 | GET_AUDIO_HW_SYNC |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 84 | }; |
| 85 | |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 86 | #define MAX_ITEMS_PER_LIST 1024 |
| 87 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | class BpAudioFlinger : public BpInterface<IAudioFlinger> |
| 89 | { |
| 90 | public: |
| 91 | BpAudioFlinger(const sp<IBinder>& impl) |
| 92 | : BpInterface<IAudioFlinger>(impl) |
| 93 | { |
| 94 | } |
| 95 | |
| 96 | virtual sp<IAudioTrack> createTrack( |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 97 | audio_stream_type_t streamType, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | uint32_t sampleRate, |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 99 | audio_format_t format, |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 100 | audio_channel_mask_t channelMask, |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 101 | size_t *pFrameCount, |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 102 | track_flags_t *flags, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 103 | const sp<IMemory>& sharedBuffer, |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 104 | audio_io_handle_t output, |
Glenn Kasten | 3acbd05 | 2012-02-28 10:39:56 -0800 | [diff] [blame] | 105 | pid_t tid, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 106 | int *sessionId, |
Marco Nelissen | 462fd2f | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 107 | int clientUid, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 108 | status_t *status) |
| 109 | { |
| 110 | Parcel data, reply; |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 111 | sp<IAudioTrack> track; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 112 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 113 | data.writeInt32((int32_t) streamType); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 114 | data.writeInt32(sampleRate); |
| 115 | data.writeInt32(format); |
Jean-Michel Trivi | 0d255b2 | 2011-05-24 15:53:33 -0700 | [diff] [blame] | 116 | data.writeInt32(channelMask); |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 117 | size_t frameCount = pFrameCount != NULL ? *pFrameCount : 0; |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 118 | data.writeInt64(frameCount); |
Glenn Kasten | b26e3e9 | 2012-11-14 08:32:08 -0800 | [diff] [blame] | 119 | track_flags_t lFlags = flags != NULL ? *flags : (track_flags_t) TRACK_DEFAULT; |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 120 | data.writeInt32(lFlags); |
Glenn Kasten | 2301acc | 2014-01-17 10:21:00 -0800 | [diff] [blame] | 121 | // haveSharedBuffer |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 122 | if (sharedBuffer != 0) { |
| 123 | data.writeInt32(true); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 124 | data.writeStrongBinder(IInterface::asBinder(sharedBuffer)); |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 125 | } else { |
| 126 | data.writeInt32(false); |
| 127 | } |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 128 | data.writeInt32((int32_t) output); |
Glenn Kasten | 3acbd05 | 2012-02-28 10:39:56 -0800 | [diff] [blame] | 129 | data.writeInt32((int32_t) tid); |
Glenn Kasten | aea7ea0 | 2013-06-26 09:25:47 -0700 | [diff] [blame] | 130 | int lSessionId = AUDIO_SESSION_ALLOCATE; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 131 | if (sessionId != NULL) { |
| 132 | lSessionId = *sessionId; |
| 133 | } |
| 134 | data.writeInt32(lSessionId); |
Marco Nelissen | 462fd2f | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 135 | data.writeInt32(clientUid); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 136 | status_t lStatus = remote()->transact(CREATE_TRACK, data, &reply); |
| 137 | if (lStatus != NO_ERROR) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 138 | ALOGE("createTrack error: %s", strerror(-lStatus)); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 139 | } else { |
Glenn Kasten | b53fc4e | 2014-05-02 08:03:58 -0700 | [diff] [blame] | 140 | frameCount = reply.readInt64(); |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 141 | if (pFrameCount != NULL) { |
| 142 | *pFrameCount = frameCount; |
| 143 | } |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 144 | lFlags = reply.readInt32(); |
| 145 | if (flags != NULL) { |
| 146 | *flags = lFlags; |
| 147 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 148 | lSessionId = reply.readInt32(); |
| 149 | if (sessionId != NULL) { |
| 150 | *sessionId = lSessionId; |
| 151 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 152 | lStatus = reply.readInt32(); |
| 153 | track = interface_cast<IAudioTrack>(reply.readStrongBinder()); |
Glenn Kasten | 0cde076 | 2014-01-16 15:06:36 -0800 | [diff] [blame] | 154 | if (lStatus == NO_ERROR) { |
| 155 | if (track == 0) { |
| 156 | ALOGE("createTrack should have returned an IAudioTrack"); |
| 157 | lStatus = UNKNOWN_ERROR; |
| 158 | } |
| 159 | } else { |
| 160 | if (track != 0) { |
| 161 | ALOGE("createTrack returned an IAudioTrack but with status %d", lStatus); |
| 162 | track.clear(); |
| 163 | } |
| 164 | } |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | } |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 166 | if (status != NULL) { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 167 | *status = lStatus; |
| 168 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 169 | return track; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | virtual sp<IAudioRecord> openRecord( |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 173 | audio_io_handle_t input, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 174 | uint32_t sampleRate, |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 175 | audio_format_t format, |
Glenn Kasten | 28b76b3 | 2012-07-03 17:24:41 -0700 | [diff] [blame] | 176 | audio_channel_mask_t channelMask, |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 177 | const String16& opPackageName, |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 178 | size_t *pFrameCount, |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 179 | track_flags_t *flags, |
Glenn Kasten | 1879fff | 2012-07-11 15:36:59 -0700 | [diff] [blame] | 180 | pid_t tid, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 181 | int *sessionId, |
Glenn Kasten | 7df8c0b | 2014-07-03 12:23:29 -0700 | [diff] [blame] | 182 | size_t *notificationFrames, |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 183 | sp<IMemory>& cblk, |
| 184 | sp<IMemory>& buffers, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 185 | status_t *status) |
| 186 | { |
| 187 | Parcel data, reply; |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 188 | sp<IAudioRecord> record; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 189 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 190 | data.writeInt32((int32_t) input); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 191 | data.writeInt32(sampleRate); |
| 192 | data.writeInt32(format); |
Jean-Michel Trivi | 0d255b2 | 2011-05-24 15:53:33 -0700 | [diff] [blame] | 193 | data.writeInt32(channelMask); |
Dianne Hackborn | eaa3470 | 2015-04-29 12:57:58 -0700 | [diff] [blame^] | 194 | data.writeString16(opPackageName); |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 195 | size_t frameCount = pFrameCount != NULL ? *pFrameCount : 0; |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 196 | data.writeInt64(frameCount); |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 197 | track_flags_t lFlags = flags != NULL ? *flags : (track_flags_t) TRACK_DEFAULT; |
| 198 | data.writeInt32(lFlags); |
Glenn Kasten | 1879fff | 2012-07-11 15:36:59 -0700 | [diff] [blame] | 199 | data.writeInt32((int32_t) tid); |
Glenn Kasten | aea7ea0 | 2013-06-26 09:25:47 -0700 | [diff] [blame] | 200 | int lSessionId = AUDIO_SESSION_ALLOCATE; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 201 | if (sessionId != NULL) { |
| 202 | lSessionId = *sessionId; |
| 203 | } |
| 204 | data.writeInt32(lSessionId); |
Glenn Kasten | 7410591 | 2014-07-03 12:28:53 -0700 | [diff] [blame] | 205 | data.writeInt64(notificationFrames != NULL ? *notificationFrames : 0); |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 206 | cblk.clear(); |
| 207 | buffers.clear(); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 208 | status_t lStatus = remote()->transact(OPEN_RECORD, data, &reply); |
| 209 | if (lStatus != NO_ERROR) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 210 | ALOGE("openRecord error: %s", strerror(-lStatus)); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 211 | } else { |
Glenn Kasten | b53fc4e | 2014-05-02 08:03:58 -0700 | [diff] [blame] | 212 | frameCount = reply.readInt64(); |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 213 | if (pFrameCount != NULL) { |
| 214 | *pFrameCount = frameCount; |
| 215 | } |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 216 | lFlags = reply.readInt32(); |
| 217 | if (flags != NULL) { |
| 218 | *flags = lFlags; |
| 219 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 220 | lSessionId = reply.readInt32(); |
| 221 | if (sessionId != NULL) { |
| 222 | *sessionId = lSessionId; |
| 223 | } |
Glenn Kasten | 7df8c0b | 2014-07-03 12:23:29 -0700 | [diff] [blame] | 224 | size_t lNotificationFrames = (size_t) reply.readInt64(); |
| 225 | if (notificationFrames != NULL) { |
| 226 | *notificationFrames = lNotificationFrames; |
| 227 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 228 | lStatus = reply.readInt32(); |
| 229 | record = interface_cast<IAudioRecord>(reply.readStrongBinder()); |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 230 | cblk = interface_cast<IMemory>(reply.readStrongBinder()); |
| 231 | if (cblk != 0 && cblk->pointer() == NULL) { |
| 232 | cblk.clear(); |
| 233 | } |
| 234 | buffers = interface_cast<IMemory>(reply.readStrongBinder()); |
| 235 | if (buffers != 0 && buffers->pointer() == NULL) { |
| 236 | buffers.clear(); |
| 237 | } |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 238 | if (lStatus == NO_ERROR) { |
| 239 | if (record == 0) { |
| 240 | ALOGE("openRecord should have returned an IAudioRecord"); |
| 241 | lStatus = UNKNOWN_ERROR; |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 242 | } else if (cblk == 0) { |
| 243 | ALOGE("openRecord should have returned a cblk"); |
| 244 | lStatus = NO_MEMORY; |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 245 | } |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 246 | // buffers is permitted to be 0 |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 247 | } else { |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 248 | if (record != 0 || cblk != 0 || buffers != 0) { |
| 249 | ALOGE("openRecord returned an IAudioRecord, cblk, " |
| 250 | "or buffers but with status %d", lStatus); |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 251 | } |
| 252 | } |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 253 | if (lStatus != NO_ERROR) { |
| 254 | record.clear(); |
| 255 | cblk.clear(); |
| 256 | buffers.clear(); |
| 257 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 258 | } |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 259 | if (status != NULL) { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 260 | *status = lStatus; |
| 261 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 262 | return record; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 263 | } |
| 264 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 265 | virtual uint32_t sampleRate(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | { |
| 267 | Parcel data, reply; |
| 268 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 269 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 270 | remote()->transact(SAMPLE_RATE, data, &reply); |
| 271 | return reply.readInt32(); |
| 272 | } |
| 273 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 274 | virtual audio_format_t format(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 275 | { |
| 276 | Parcel data, reply; |
| 277 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 278 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 279 | remote()->transact(FORMAT, data, &reply); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 280 | return (audio_format_t) reply.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 281 | } |
| 282 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 283 | virtual size_t frameCount(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 284 | { |
| 285 | Parcel data, reply; |
| 286 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 287 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 288 | remote()->transact(FRAME_COUNT, data, &reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 289 | return reply.readInt64(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 290 | } |
| 291 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 292 | virtual uint32_t latency(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 293 | { |
| 294 | Parcel data, reply; |
| 295 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 296 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 297 | remote()->transact(LATENCY, data, &reply); |
| 298 | return reply.readInt32(); |
| 299 | } |
| 300 | |
| 301 | virtual status_t setMasterVolume(float value) |
| 302 | { |
| 303 | Parcel data, reply; |
| 304 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 305 | data.writeFloat(value); |
| 306 | remote()->transact(SET_MASTER_VOLUME, data, &reply); |
| 307 | return reply.readInt32(); |
| 308 | } |
| 309 | |
| 310 | virtual status_t setMasterMute(bool muted) |
| 311 | { |
| 312 | Parcel data, reply; |
| 313 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 314 | data.writeInt32(muted); |
| 315 | remote()->transact(SET_MASTER_MUTE, data, &reply); |
| 316 | return reply.readInt32(); |
| 317 | } |
| 318 | |
| 319 | virtual float masterVolume() const |
| 320 | { |
| 321 | Parcel data, reply; |
| 322 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 323 | remote()->transact(MASTER_VOLUME, data, &reply); |
| 324 | return reply.readFloat(); |
| 325 | } |
| 326 | |
| 327 | virtual bool masterMute() const |
| 328 | { |
| 329 | Parcel data, reply; |
| 330 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 331 | remote()->transact(MASTER_MUTE, data, &reply); |
| 332 | return reply.readInt32(); |
| 333 | } |
| 334 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 335 | virtual status_t setStreamVolume(audio_stream_type_t stream, float value, |
| 336 | audio_io_handle_t output) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 337 | { |
| 338 | Parcel data, reply; |
| 339 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 340 | data.writeInt32((int32_t) stream); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 341 | data.writeFloat(value); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 342 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 343 | remote()->transact(SET_STREAM_VOLUME, data, &reply); |
| 344 | return reply.readInt32(); |
| 345 | } |
| 346 | |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 347 | virtual status_t setStreamMute(audio_stream_type_t stream, bool muted) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 348 | { |
| 349 | Parcel data, reply; |
| 350 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 351 | data.writeInt32((int32_t) stream); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 352 | data.writeInt32(muted); |
| 353 | remote()->transact(SET_STREAM_MUTE, data, &reply); |
| 354 | return reply.readInt32(); |
| 355 | } |
| 356 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 357 | virtual float streamVolume(audio_stream_type_t stream, audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 358 | { |
| 359 | Parcel data, reply; |
| 360 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 361 | data.writeInt32((int32_t) stream); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 362 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 363 | remote()->transact(STREAM_VOLUME, data, &reply); |
| 364 | return reply.readFloat(); |
| 365 | } |
| 366 | |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 367 | virtual bool streamMute(audio_stream_type_t stream) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 368 | { |
| 369 | Parcel data, reply; |
| 370 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 371 | data.writeInt32((int32_t) stream); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 372 | remote()->transact(STREAM_MUTE, data, &reply); |
| 373 | return reply.readInt32(); |
| 374 | } |
| 375 | |
Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 376 | virtual status_t setMode(audio_mode_t mode) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 377 | { |
| 378 | Parcel data, reply; |
| 379 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 380 | data.writeInt32(mode); |
| 381 | remote()->transact(SET_MODE, data, &reply); |
| 382 | return reply.readInt32(); |
| 383 | } |
| 384 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 385 | virtual status_t setMicMute(bool state) |
| 386 | { |
| 387 | Parcel data, reply; |
| 388 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 389 | data.writeInt32(state); |
| 390 | remote()->transact(SET_MIC_MUTE, data, &reply); |
| 391 | return reply.readInt32(); |
| 392 | } |
| 393 | |
| 394 | virtual bool getMicMute() const |
| 395 | { |
| 396 | Parcel data, reply; |
| 397 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 398 | remote()->transact(GET_MIC_MUTE, data, &reply); |
| 399 | return reply.readInt32(); |
| 400 | } |
| 401 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 402 | virtual status_t setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 403 | { |
| 404 | Parcel data, reply; |
| 405 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 406 | data.writeInt32((int32_t) ioHandle); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 407 | data.writeString8(keyValuePairs); |
| 408 | remote()->transact(SET_PARAMETERS, data, &reply); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 409 | return reply.readInt32(); |
| 410 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 411 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 412 | virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) const |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 413 | { |
| 414 | Parcel data, reply; |
| 415 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 416 | data.writeInt32((int32_t) ioHandle); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 417 | data.writeString8(keys); |
| 418 | remote()->transact(GET_PARAMETERS, data, &reply); |
| 419 | return reply.readString8(); |
| 420 | } |
| 421 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 422 | virtual void registerClient(const sp<IAudioFlingerClient>& client) |
| 423 | { |
| 424 | Parcel data, reply; |
| 425 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 426 | data.writeStrongBinder(IInterface::asBinder(client)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 427 | remote()->transact(REGISTER_CLIENT, data, &reply); |
| 428 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 429 | |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 430 | virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, |
| 431 | audio_channel_mask_t channelMask) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 432 | { |
| 433 | Parcel data, reply; |
| 434 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 435 | data.writeInt32(sampleRate); |
| 436 | data.writeInt32(format); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 437 | data.writeInt32(channelMask); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 438 | remote()->transact(GET_INPUTBUFFERSIZE, data, &reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 439 | return reply.readInt64(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 440 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 441 | |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 442 | virtual status_t openOutput(audio_module_handle_t module, |
| 443 | audio_io_handle_t *output, |
| 444 | audio_config_t *config, |
| 445 | audio_devices_t *devices, |
| 446 | const String8& address, |
| 447 | uint32_t *latencyMs, |
| 448 | audio_output_flags_t flags) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 449 | { |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 450 | if (output == NULL || config == NULL || devices == NULL || latencyMs == NULL) { |
| 451 | return BAD_VALUE; |
| 452 | } |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 453 | Parcel data, reply; |
| 454 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 455 | data.writeInt32(module); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 456 | data.write(config, sizeof(audio_config_t)); |
| 457 | data.writeInt32(*devices); |
| 458 | data.writeString8(address); |
Glenn Kasten | 18868c5 | 2012-03-07 09:15:37 -0800 | [diff] [blame] | 459 | data.writeInt32((int32_t) flags); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 460 | status_t status = remote()->transact(OPEN_OUTPUT, data, &reply); |
| 461 | if (status != NO_ERROR) { |
| 462 | *output = AUDIO_IO_HANDLE_NONE; |
| 463 | return status; |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 464 | } |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 465 | status = (status_t)reply.readInt32(); |
| 466 | if (status != NO_ERROR) { |
| 467 | *output = AUDIO_IO_HANDLE_NONE; |
| 468 | return status; |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 469 | } |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 470 | *output = (audio_io_handle_t)reply.readInt32(); |
| 471 | ALOGV("openOutput() returned output, %d", *output); |
| 472 | reply.read(config, sizeof(audio_config_t)); |
| 473 | *devices = (audio_devices_t)reply.readInt32(); |
| 474 | *latencyMs = reply.readInt32(); |
| 475 | return NO_ERROR; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 476 | } |
| 477 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 478 | virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, |
| 479 | audio_io_handle_t output2) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 480 | { |
| 481 | Parcel data, reply; |
| 482 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 483 | data.writeInt32((int32_t) output1); |
| 484 | data.writeInt32((int32_t) output2); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 485 | remote()->transact(OPEN_DUPLICATE_OUTPUT, data, &reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 486 | return (audio_io_handle_t) reply.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 487 | } |
| 488 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 489 | virtual status_t closeOutput(audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 490 | { |
| 491 | Parcel data, reply; |
| 492 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 493 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 494 | remote()->transact(CLOSE_OUTPUT, data, &reply); |
| 495 | return reply.readInt32(); |
| 496 | } |
| 497 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 498 | virtual status_t suspendOutput(audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 499 | { |
| 500 | Parcel data, reply; |
| 501 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 502 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 503 | remote()->transact(SUSPEND_OUTPUT, data, &reply); |
| 504 | return reply.readInt32(); |
| 505 | } |
| 506 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 507 | virtual status_t restoreOutput(audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 508 | { |
| 509 | Parcel data, reply; |
| 510 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 511 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 512 | remote()->transact(RESTORE_OUTPUT, data, &reply); |
| 513 | return reply.readInt32(); |
| 514 | } |
| 515 | |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 516 | virtual status_t openInput(audio_module_handle_t module, |
| 517 | audio_io_handle_t *input, |
| 518 | audio_config_t *config, |
| 519 | audio_devices_t *device, |
| 520 | const String8& address, |
| 521 | audio_source_t source, |
| 522 | audio_input_flags_t flags) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 523 | { |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 524 | if (input == NULL || config == NULL || device == NULL) { |
| 525 | return BAD_VALUE; |
| 526 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 527 | Parcel data, reply; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 528 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 529 | data.writeInt32(module); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 530 | data.writeInt32(*input); |
| 531 | data.write(config, sizeof(audio_config_t)); |
| 532 | data.writeInt32(*device); |
| 533 | data.writeString8(address); |
| 534 | data.writeInt32(source); |
Glenn Kasten | ec40d28 | 2014-07-15 15:31:26 -0700 | [diff] [blame] | 535 | data.writeInt32(flags); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 536 | status_t status = remote()->transact(OPEN_INPUT, data, &reply); |
| 537 | if (status != NO_ERROR) { |
| 538 | *input = AUDIO_IO_HANDLE_NONE; |
| 539 | return status; |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 540 | } |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 541 | status = (status_t)reply.readInt32(); |
| 542 | if (status != NO_ERROR) { |
| 543 | *input = AUDIO_IO_HANDLE_NONE; |
| 544 | return status; |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 545 | } |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 546 | *input = (audio_io_handle_t)reply.readInt32(); |
| 547 | reply.read(config, sizeof(audio_config_t)); |
| 548 | *device = (audio_devices_t)reply.readInt32(); |
| 549 | return NO_ERROR; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 550 | } |
| 551 | |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 552 | virtual status_t closeInput(int input) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 553 | { |
| 554 | Parcel data, reply; |
| 555 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 556 | data.writeInt32(input); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 557 | remote()->transact(CLOSE_INPUT, data, &reply); |
| 558 | return reply.readInt32(); |
| 559 | } |
| 560 | |
Glenn Kasten | d2304db | 2014-02-03 07:40:31 -0800 | [diff] [blame] | 561 | virtual status_t invalidateStream(audio_stream_type_t stream) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 562 | { |
| 563 | Parcel data, reply; |
| 564 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 565 | data.writeInt32((int32_t) stream); |
Glenn Kasten | d2304db | 2014-02-03 07:40:31 -0800 | [diff] [blame] | 566 | remote()->transact(INVALIDATE_STREAM, data, &reply); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 567 | return reply.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 568 | } |
Eric Laurent | f0ee6f4 | 2009-10-21 08:14:22 -0700 | [diff] [blame] | 569 | |
| 570 | virtual status_t setVoiceVolume(float volume) |
| 571 | { |
| 572 | Parcel data, reply; |
| 573 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 574 | data.writeFloat(volume); |
| 575 | remote()->transact(SET_VOICE_VOLUME, data, &reply); |
| 576 | return reply.readInt32(); |
| 577 | } |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 578 | |
Kévin PETIT | 377b2ec | 2014-02-03 12:35:36 +0000 | [diff] [blame] | 579 | virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 580 | audio_io_handle_t output) const |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 581 | { |
| 582 | Parcel data, reply; |
| 583 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 584 | data.writeInt32((int32_t) output); |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 585 | remote()->transact(GET_RENDER_POSITION, data, &reply); |
| 586 | status_t status = reply.readInt32(); |
| 587 | if (status == NO_ERROR) { |
| 588 | uint32_t tmp = reply.readInt32(); |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 589 | if (halFrames != NULL) { |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 590 | *halFrames = tmp; |
| 591 | } |
| 592 | tmp = reply.readInt32(); |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 593 | if (dspFrames != NULL) { |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 594 | *dspFrames = tmp; |
| 595 | } |
| 596 | } |
| 597 | return status; |
| 598 | } |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 599 | |
Glenn Kasten | 5f972c0 | 2014-01-13 09:59:31 -0800 | [diff] [blame] | 600 | virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 601 | { |
| 602 | Parcel data, reply; |
| 603 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 604 | data.writeInt32((int32_t) ioHandle); |
Glenn Kasten | 5f972c0 | 2014-01-13 09:59:31 -0800 | [diff] [blame] | 605 | status_t status = remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply); |
| 606 | if (status != NO_ERROR) { |
| 607 | return 0; |
| 608 | } |
| 609 | return (uint32_t) reply.readInt32(); |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 610 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 611 | |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 612 | virtual audio_unique_id_t newAudioUniqueId() |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 613 | { |
| 614 | Parcel data, reply; |
| 615 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 616 | status_t status = remote()->transact(NEW_AUDIO_SESSION_ID, data, &reply); |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 617 | audio_unique_id_t id = AUDIO_SESSION_ALLOCATE; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 618 | if (status == NO_ERROR) { |
| 619 | id = reply.readInt32(); |
| 620 | } |
| 621 | return id; |
| 622 | } |
| 623 | |
Marco Nelissen | d457c97 | 2014-02-11 08:47:07 -0800 | [diff] [blame] | 624 | virtual void acquireAudioSessionId(int audioSession, int pid) |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 625 | { |
| 626 | Parcel data, reply; |
| 627 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 628 | data.writeInt32(audioSession); |
Marco Nelissen | d457c97 | 2014-02-11 08:47:07 -0800 | [diff] [blame] | 629 | data.writeInt32(pid); |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 630 | remote()->transact(ACQUIRE_AUDIO_SESSION_ID, data, &reply); |
| 631 | } |
| 632 | |
Marco Nelissen | d457c97 | 2014-02-11 08:47:07 -0800 | [diff] [blame] | 633 | virtual void releaseAudioSessionId(int audioSession, int pid) |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 634 | { |
| 635 | Parcel data, reply; |
| 636 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 637 | data.writeInt32(audioSession); |
Marco Nelissen | d457c97 | 2014-02-11 08:47:07 -0800 | [diff] [blame] | 638 | data.writeInt32(pid); |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 639 | remote()->transact(RELEASE_AUDIO_SESSION_ID, data, &reply); |
| 640 | } |
| 641 | |
Glenn Kasten | f587ba5 | 2012-01-26 16:25:10 -0800 | [diff] [blame] | 642 | virtual status_t queryNumberEffects(uint32_t *numEffects) const |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 643 | { |
| 644 | Parcel data, reply; |
| 645 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 646 | status_t status = remote()->transact(QUERY_NUM_EFFECTS, data, &reply); |
| 647 | if (status != NO_ERROR) { |
| 648 | return status; |
| 649 | } |
| 650 | status = reply.readInt32(); |
| 651 | if (status != NO_ERROR) { |
| 652 | return status; |
| 653 | } |
Glenn Kasten | 9d1f02d | 2012-02-08 17:47:58 -0800 | [diff] [blame] | 654 | if (numEffects != NULL) { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 655 | *numEffects = (uint32_t)reply.readInt32(); |
| 656 | } |
| 657 | return NO_ERROR; |
| 658 | } |
| 659 | |
Glenn Kasten | f587ba5 | 2012-01-26 16:25:10 -0800 | [diff] [blame] | 660 | virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) const |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 661 | { |
| 662 | if (pDescriptor == NULL) { |
| 663 | return BAD_VALUE; |
| 664 | } |
| 665 | Parcel data, reply; |
| 666 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 667 | data.writeInt32(index); |
| 668 | status_t status = remote()->transact(QUERY_EFFECT, data, &reply); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 669 | if (status != NO_ERROR) { |
| 670 | return status; |
| 671 | } |
| 672 | status = reply.readInt32(); |
| 673 | if (status != NO_ERROR) { |
| 674 | return status; |
| 675 | } |
| 676 | reply.read(pDescriptor, sizeof(effect_descriptor_t)); |
| 677 | return NO_ERROR; |
| 678 | } |
| 679 | |
Glenn Kasten | 5e92a78 | 2012-01-30 07:40:52 -0800 | [diff] [blame] | 680 | virtual status_t getEffectDescriptor(const effect_uuid_t *pUuid, |
Glenn Kasten | f587ba5 | 2012-01-26 16:25:10 -0800 | [diff] [blame] | 681 | effect_descriptor_t *pDescriptor) const |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 682 | { |
| 683 | if (pUuid == NULL || pDescriptor == NULL) { |
| 684 | return BAD_VALUE; |
| 685 | } |
| 686 | Parcel data, reply; |
| 687 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 688 | data.write(pUuid, sizeof(effect_uuid_t)); |
| 689 | status_t status = remote()->transact(GET_EFFECT_DESCRIPTOR, data, &reply); |
| 690 | if (status != NO_ERROR) { |
| 691 | return status; |
| 692 | } |
| 693 | status = reply.readInt32(); |
| 694 | if (status != NO_ERROR) { |
| 695 | return status; |
| 696 | } |
| 697 | reply.read(pDescriptor, sizeof(effect_descriptor_t)); |
| 698 | return NO_ERROR; |
| 699 | } |
| 700 | |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 701 | virtual sp<IEffect> createEffect( |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 702 | effect_descriptor_t *pDesc, |
| 703 | const sp<IEffectClient>& client, |
| 704 | int32_t priority, |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 705 | audio_io_handle_t output, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 706 | int sessionId, |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 707 | const String16& opPackageName, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 708 | status_t *status, |
| 709 | int *id, |
| 710 | int *enabled) |
| 711 | { |
| 712 | Parcel data, reply; |
| 713 | sp<IEffect> effect; |
| 714 | |
| 715 | if (pDesc == NULL) { |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 716 | return effect; |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 717 | if (status != NULL) { |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 718 | *status = BAD_VALUE; |
| 719 | } |
| 720 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 721 | |
| 722 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 723 | data.write(pDesc, sizeof(effect_descriptor_t)); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 724 | data.writeStrongBinder(IInterface::asBinder(client)); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 725 | data.writeInt32(priority); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 726 | data.writeInt32((int32_t) output); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 727 | data.writeInt32(sessionId); |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 728 | data.writeString16(opPackageName); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 729 | |
| 730 | status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply); |
| 731 | if (lStatus != NO_ERROR) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 732 | ALOGE("createEffect error: %s", strerror(-lStatus)); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 733 | } else { |
| 734 | lStatus = reply.readInt32(); |
| 735 | int tmp = reply.readInt32(); |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 736 | if (id != NULL) { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 737 | *id = tmp; |
| 738 | } |
| 739 | tmp = reply.readInt32(); |
Glenn Kasten | a0d6833 | 2012-01-27 16:47:15 -0800 | [diff] [blame] | 740 | if (enabled != NULL) { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 741 | *enabled = tmp; |
| 742 | } |
| 743 | effect = interface_cast<IEffect>(reply.readStrongBinder()); |
| 744 | reply.read(pDesc, sizeof(effect_descriptor_t)); |
| 745 | } |
Glenn Kasten | 507b286 | 2013-07-31 16:12:13 -0700 | [diff] [blame] | 746 | if (status != NULL) { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 747 | *status = lStatus; |
| 748 | } |
| 749 | |
| 750 | return effect; |
| 751 | } |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 752 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 753 | virtual status_t moveEffects(int session, audio_io_handle_t srcOutput, |
| 754 | audio_io_handle_t dstOutput) |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 755 | { |
| 756 | Parcel data, reply; |
| 757 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 758 | data.writeInt32(session); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 759 | data.writeInt32((int32_t) srcOutput); |
| 760 | data.writeInt32((int32_t) dstOutput); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 761 | remote()->transact(MOVE_EFFECTS, data, &reply); |
| 762 | return reply.readInt32(); |
| 763 | } |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 764 | |
| 765 | virtual audio_module_handle_t loadHwModule(const char *name) |
| 766 | { |
| 767 | Parcel data, reply; |
| 768 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 769 | data.writeCString(name); |
| 770 | remote()->transact(LOAD_HW_MODULE, data, &reply); |
| 771 | return (audio_module_handle_t) reply.readInt32(); |
| 772 | } |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 773 | |
Glenn Kasten | 3b16c76 | 2012-11-14 08:44:39 -0800 | [diff] [blame] | 774 | virtual uint32_t getPrimaryOutputSamplingRate() |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 775 | { |
| 776 | Parcel data, reply; |
| 777 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 778 | remote()->transact(GET_PRIMARY_OUTPUT_SAMPLING_RATE, data, &reply); |
| 779 | return reply.readInt32(); |
| 780 | } |
| 781 | |
Glenn Kasten | e33054e | 2012-11-14 12:54:39 -0800 | [diff] [blame] | 782 | virtual size_t getPrimaryOutputFrameCount() |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 783 | { |
| 784 | Parcel data, reply; |
| 785 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 786 | remote()->transact(GET_PRIMARY_OUTPUT_FRAME_COUNT, data, &reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 787 | return reply.readInt64(); |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 788 | } |
| 789 | |
Glenn Kasten | 4182c4e | 2013-07-15 14:45:07 -0700 | [diff] [blame] | 790 | virtual status_t setLowRamDevice(bool isLowRamDevice) |
| 791 | { |
| 792 | Parcel data, reply; |
| 793 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 794 | data.writeInt32((int) isLowRamDevice); |
| 795 | remote()->transact(SET_LOW_RAM_DEVICE, data, &reply); |
| 796 | return reply.readInt32(); |
| 797 | } |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 798 | virtual status_t listAudioPorts(unsigned int *num_ports, |
| 799 | struct audio_port *ports) |
| 800 | { |
| 801 | if (num_ports == NULL || *num_ports == 0 || ports == NULL) { |
| 802 | return BAD_VALUE; |
| 803 | } |
| 804 | Parcel data, reply; |
| 805 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 806 | data.writeInt32(*num_ports); |
| 807 | status_t status = remote()->transact(LIST_AUDIO_PORTS, data, &reply); |
| 808 | if (status != NO_ERROR || |
| 809 | (status = (status_t)reply.readInt32()) != NO_ERROR) { |
| 810 | return status; |
| 811 | } |
| 812 | *num_ports = (unsigned int)reply.readInt32(); |
| 813 | reply.read(ports, *num_ports * sizeof(struct audio_port)); |
| 814 | return status; |
| 815 | } |
| 816 | virtual status_t getAudioPort(struct audio_port *port) |
| 817 | { |
| 818 | if (port == NULL) { |
| 819 | return BAD_VALUE; |
| 820 | } |
| 821 | Parcel data, reply; |
| 822 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 823 | data.write(port, sizeof(struct audio_port)); |
| 824 | status_t status = remote()->transact(GET_AUDIO_PORT, data, &reply); |
| 825 | if (status != NO_ERROR || |
| 826 | (status = (status_t)reply.readInt32()) != NO_ERROR) { |
| 827 | return status; |
| 828 | } |
| 829 | reply.read(port, sizeof(struct audio_port)); |
| 830 | return status; |
| 831 | } |
| 832 | virtual status_t createAudioPatch(const struct audio_patch *patch, |
| 833 | audio_patch_handle_t *handle) |
| 834 | { |
| 835 | if (patch == NULL || handle == NULL) { |
| 836 | return BAD_VALUE; |
| 837 | } |
| 838 | Parcel data, reply; |
| 839 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 840 | data.write(patch, sizeof(struct audio_patch)); |
| 841 | data.write(handle, sizeof(audio_patch_handle_t)); |
| 842 | status_t status = remote()->transact(CREATE_AUDIO_PATCH, data, &reply); |
| 843 | if (status != NO_ERROR || |
| 844 | (status = (status_t)reply.readInt32()) != NO_ERROR) { |
| 845 | return status; |
| 846 | } |
| 847 | reply.read(handle, sizeof(audio_patch_handle_t)); |
| 848 | return status; |
| 849 | } |
| 850 | virtual status_t releaseAudioPatch(audio_patch_handle_t handle) |
| 851 | { |
| 852 | Parcel data, reply; |
| 853 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 854 | data.write(&handle, sizeof(audio_patch_handle_t)); |
| 855 | status_t status = remote()->transact(RELEASE_AUDIO_PATCH, data, &reply); |
| 856 | if (status != NO_ERROR) { |
| 857 | status = (status_t)reply.readInt32(); |
| 858 | } |
| 859 | return status; |
| 860 | } |
| 861 | virtual status_t listAudioPatches(unsigned int *num_patches, |
| 862 | struct audio_patch *patches) |
| 863 | { |
| 864 | if (num_patches == NULL || *num_patches == 0 || patches == NULL) { |
| 865 | return BAD_VALUE; |
| 866 | } |
| 867 | Parcel data, reply; |
| 868 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 869 | data.writeInt32(*num_patches); |
| 870 | status_t status = remote()->transact(LIST_AUDIO_PATCHES, data, &reply); |
| 871 | if (status != NO_ERROR || |
| 872 | (status = (status_t)reply.readInt32()) != NO_ERROR) { |
| 873 | return status; |
| 874 | } |
| 875 | *num_patches = (unsigned int)reply.readInt32(); |
| 876 | reply.read(patches, *num_patches * sizeof(struct audio_patch)); |
| 877 | return status; |
| 878 | } |
| 879 | virtual status_t setAudioPortConfig(const struct audio_port_config *config) |
| 880 | { |
| 881 | if (config == NULL) { |
| 882 | return BAD_VALUE; |
| 883 | } |
| 884 | Parcel data, reply; |
| 885 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 886 | data.write(config, sizeof(struct audio_port_config)); |
| 887 | status_t status = remote()->transact(SET_AUDIO_PORT_CONFIG, data, &reply); |
| 888 | if (status != NO_ERROR) { |
| 889 | status = (status_t)reply.readInt32(); |
| 890 | } |
| 891 | return status; |
| 892 | } |
Eric Laurent | 93c3d41 | 2014-08-01 14:48:35 -0700 | [diff] [blame] | 893 | virtual audio_hw_sync_t getAudioHwSyncForSession(audio_session_t sessionId) |
| 894 | { |
| 895 | Parcel data, reply; |
| 896 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 897 | data.writeInt32(sessionId); |
| 898 | status_t status = remote()->transact(GET_AUDIO_HW_SYNC, data, &reply); |
| 899 | if (status != NO_ERROR) { |
| 900 | return AUDIO_HW_SYNC_INVALID; |
| 901 | } |
| 902 | return (audio_hw_sync_t)reply.readInt32(); |
| 903 | } |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 904 | }; |
| 905 | |
| 906 | IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); |
| 907 | |
| 908 | // ---------------------------------------------------------------------- |
| 909 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 910 | status_t BnAudioFlinger::onTransact( |
| 911 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 912 | { |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 913 | switch (code) { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 914 | case CREATE_TRACK: { |
| 915 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 916 | int streamType = data.readInt32(); |
| 917 | uint32_t sampleRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 918 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 919 | audio_channel_mask_t channelMask = data.readInt32(); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 920 | size_t frameCount = data.readInt64(); |
Glenn Kasten | a075db4 | 2012-03-06 11:22:44 -0800 | [diff] [blame] | 921 | track_flags_t flags = (track_flags_t) data.readInt32(); |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 922 | bool haveSharedBuffer = data.readInt32() != 0; |
| 923 | sp<IMemory> buffer; |
| 924 | if (haveSharedBuffer) { |
| 925 | buffer = interface_cast<IMemory>(data.readStrongBinder()); |
| 926 | } |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 927 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Glenn Kasten | 3acbd05 | 2012-02-28 10:39:56 -0800 | [diff] [blame] | 928 | pid_t tid = (pid_t) data.readInt32(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 929 | int sessionId = data.readInt32(); |
Marco Nelissen | 462fd2f | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 930 | int clientUid = data.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 931 | status_t status; |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 932 | sp<IAudioTrack> track; |
| 933 | if ((haveSharedBuffer && (buffer == 0)) || |
| 934 | ((buffer != 0) && (buffer->pointer() == NULL))) { |
| 935 | ALOGW("CREATE_TRACK: cannot retrieve shared memory"); |
| 936 | status = DEAD_OBJECT; |
| 937 | } else { |
| 938 | track = createTrack( |
| 939 | (audio_stream_type_t) streamType, sampleRate, format, |
Glenn Kasten | 74935e4 | 2013-12-19 08:56:45 -0800 | [diff] [blame] | 940 | channelMask, &frameCount, &flags, buffer, output, tid, |
Glenn Kasten | c5a1742 | 2014-03-13 14:59:59 -0700 | [diff] [blame] | 941 | &sessionId, clientUid, &status); |
Glenn Kasten | 0cde076 | 2014-01-16 15:06:36 -0800 | [diff] [blame] | 942 | LOG_ALWAYS_FATAL_IF((track != 0) != (status == NO_ERROR)); |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 943 | } |
Glenn Kasten | b53fc4e | 2014-05-02 08:03:58 -0700 | [diff] [blame] | 944 | reply->writeInt64(frameCount); |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 945 | reply->writeInt32(flags); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 946 | reply->writeInt32(sessionId); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 947 | reply->writeInt32(status); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 948 | reply->writeStrongBinder(IInterface::asBinder(track)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 949 | return NO_ERROR; |
| 950 | } break; |
| 951 | case OPEN_RECORD: { |
| 952 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 953 | audio_io_handle_t input = (audio_io_handle_t) data.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 954 | uint32_t sampleRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 955 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 956 | audio_channel_mask_t channelMask = data.readInt32(); |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 957 | const String16& opPackageName = data.readString16(); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 958 | size_t frameCount = data.readInt64(); |
Glenn Kasten | a075db4 | 2012-03-06 11:22:44 -0800 | [diff] [blame] | 959 | track_flags_t flags = (track_flags_t) data.readInt32(); |
Glenn Kasten | 1879fff | 2012-07-11 15:36:59 -0700 | [diff] [blame] | 960 | pid_t tid = (pid_t) data.readInt32(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 961 | int sessionId = data.readInt32(); |
Glenn Kasten | 7410591 | 2014-07-03 12:28:53 -0700 | [diff] [blame] | 962 | size_t notificationFrames = data.readInt64(); |
Glenn Kasten | d776ac6 | 2014-05-07 09:16:09 -0700 | [diff] [blame] | 963 | sp<IMemory> cblk; |
| 964 | sp<IMemory> buffers; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 965 | status_t status; |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 966 | sp<IAudioRecord> record = openRecord(input, |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 967 | sampleRate, format, channelMask, opPackageName, &frameCount, &flags, tid, |
| 968 | &sessionId, ¬ificationFrames, cblk, buffers, &status); |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 969 | LOG_ALWAYS_FATAL_IF((record != 0) != (status == NO_ERROR)); |
Glenn Kasten | b53fc4e | 2014-05-02 08:03:58 -0700 | [diff] [blame] | 970 | reply->writeInt64(frameCount); |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 971 | reply->writeInt32(flags); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 972 | reply->writeInt32(sessionId); |
Glenn Kasten | 7df8c0b | 2014-07-03 12:23:29 -0700 | [diff] [blame] | 973 | reply->writeInt64(notificationFrames); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 974 | reply->writeInt32(status); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 975 | reply->writeStrongBinder(IInterface::asBinder(record)); |
| 976 | reply->writeStrongBinder(IInterface::asBinder(cblk)); |
| 977 | reply->writeStrongBinder(IInterface::asBinder(buffers)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 978 | return NO_ERROR; |
| 979 | } break; |
| 980 | case SAMPLE_RATE: { |
| 981 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 982 | reply->writeInt32( sampleRate((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 983 | return NO_ERROR; |
| 984 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 985 | case FORMAT: { |
| 986 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 987 | reply->writeInt32( format((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 988 | return NO_ERROR; |
| 989 | } break; |
| 990 | case FRAME_COUNT: { |
| 991 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 992 | reply->writeInt64( frameCount((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 993 | return NO_ERROR; |
| 994 | } break; |
| 995 | case LATENCY: { |
| 996 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 997 | reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 998 | return NO_ERROR; |
| 999 | } break; |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 1000 | case SET_MASTER_VOLUME: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1001 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1002 | reply->writeInt32( setMasterVolume(data.readFloat()) ); |
| 1003 | return NO_ERROR; |
| 1004 | } break; |
| 1005 | case SET_MASTER_MUTE: { |
| 1006 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1007 | reply->writeInt32( setMasterMute(data.readInt32()) ); |
| 1008 | return NO_ERROR; |
| 1009 | } break; |
| 1010 | case MASTER_VOLUME: { |
| 1011 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1012 | reply->writeFloat( masterVolume() ); |
| 1013 | return NO_ERROR; |
| 1014 | } break; |
| 1015 | case MASTER_MUTE: { |
| 1016 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1017 | reply->writeInt32( masterMute() ); |
| 1018 | return NO_ERROR; |
| 1019 | } break; |
| 1020 | case SET_STREAM_VOLUME: { |
| 1021 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1022 | int stream = data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1023 | float volume = data.readFloat(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1024 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 1025 | reply->writeInt32( setStreamVolume((audio_stream_type_t) stream, volume, output) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1026 | return NO_ERROR; |
| 1027 | } break; |
| 1028 | case SET_STREAM_MUTE: { |
| 1029 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1030 | int stream = data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 1031 | reply->writeInt32( setStreamMute((audio_stream_type_t) stream, data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1032 | return NO_ERROR; |
| 1033 | } break; |
| 1034 | case STREAM_VOLUME: { |
| 1035 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1036 | int stream = data.readInt32(); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 1037 | int output = data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 1038 | reply->writeFloat( streamVolume((audio_stream_type_t) stream, output) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1039 | return NO_ERROR; |
| 1040 | } break; |
| 1041 | case STREAM_MUTE: { |
| 1042 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1043 | int stream = data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 1044 | reply->writeInt32( streamMute((audio_stream_type_t) stream) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1045 | return NO_ERROR; |
| 1046 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1047 | case SET_MODE: { |
| 1048 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 1049 | audio_mode_t mode = (audio_mode_t) data.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1050 | reply->writeInt32( setMode(mode) ); |
| 1051 | return NO_ERROR; |
| 1052 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1053 | case SET_MIC_MUTE: { |
| 1054 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1055 | int state = data.readInt32(); |
| 1056 | reply->writeInt32( setMicMute(state) ); |
| 1057 | return NO_ERROR; |
| 1058 | } break; |
| 1059 | case GET_MIC_MUTE: { |
| 1060 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1061 | reply->writeInt32( getMicMute() ); |
| 1062 | return NO_ERROR; |
| 1063 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1064 | case SET_PARAMETERS: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1065 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1066 | audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1067 | String8 keyValuePairs(data.readString8()); |
| 1068 | reply->writeInt32(setParameters(ioHandle, keyValuePairs)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1069 | return NO_ERROR; |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 1070 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1071 | case GET_PARAMETERS: { |
| 1072 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1073 | audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1074 | String8 keys(data.readString8()); |
| 1075 | reply->writeString8(getParameters(ioHandle, keys)); |
| 1076 | return NO_ERROR; |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 1077 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1078 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1079 | case REGISTER_CLIENT: { |
| 1080 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 1081 | sp<IAudioFlingerClient> client = interface_cast<IAudioFlingerClient>( |
| 1082 | data.readStrongBinder()); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1083 | registerClient(client); |
| 1084 | return NO_ERROR; |
| 1085 | } break; |
| 1086 | case GET_INPUTBUFFERSIZE: { |
| 1087 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1088 | uint32_t sampleRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 1089 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 1090 | audio_channel_mask_t channelMask = data.readInt32(); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 1091 | reply->writeInt64( getInputBufferSize(sampleRate, format, channelMask) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1092 | return NO_ERROR; |
| 1093 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1094 | case OPEN_OUTPUT: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1095 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 1096 | audio_module_handle_t module = (audio_module_handle_t)data.readInt32(); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 1097 | audio_config_t config; |
| 1098 | data.read(&config, sizeof(audio_config_t)); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 1099 | audio_devices_t devices = (audio_devices_t)data.readInt32(); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 1100 | String8 address(data.readString8()); |
Eric Laurent | 0ca3cf9 | 2012-04-18 09:24:29 -0700 | [diff] [blame] | 1101 | audio_output_flags_t flags = (audio_output_flags_t) data.readInt32(); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 1102 | uint32_t latencyMs; |
| 1103 | audio_io_handle_t output; |
| 1104 | status_t status = openOutput(module, &output, &config, |
| 1105 | &devices, address, &latencyMs, flags); |
Glenn Kasten | 7074296 | 2014-02-18 08:00:47 -0800 | [diff] [blame] | 1106 | ALOGV("OPEN_OUTPUT output, %d", output); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 1107 | reply->writeInt32((int32_t)status); |
| 1108 | if (status == NO_ERROR) { |
| 1109 | reply->writeInt32((int32_t)output); |
| 1110 | reply->write(&config, sizeof(audio_config_t)); |
| 1111 | reply->writeInt32(devices); |
| 1112 | reply->writeInt32(latencyMs); |
| 1113 | } |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1114 | return NO_ERROR; |
| 1115 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1116 | case OPEN_DUPLICATE_OUTPUT: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1117 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1118 | audio_io_handle_t output1 = (audio_io_handle_t) data.readInt32(); |
| 1119 | audio_io_handle_t output2 = (audio_io_handle_t) data.readInt32(); |
| 1120 | reply->writeInt32((int32_t) openDuplicateOutput(output1, output2)); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1121 | return NO_ERROR; |
| 1122 | } break; |
| 1123 | case CLOSE_OUTPUT: { |
| 1124 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1125 | reply->writeInt32(closeOutput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1126 | return NO_ERROR; |
| 1127 | } break; |
| 1128 | case SUSPEND_OUTPUT: { |
| 1129 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1130 | reply->writeInt32(suspendOutput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1131 | return NO_ERROR; |
| 1132 | } break; |
| 1133 | case RESTORE_OUTPUT: { |
| 1134 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1135 | reply->writeInt32(restoreOutput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1136 | return NO_ERROR; |
| 1137 | } break; |
| 1138 | case OPEN_INPUT: { |
| 1139 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 1140 | audio_module_handle_t module = (audio_module_handle_t)data.readInt32(); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 1141 | audio_io_handle_t input = (audio_io_handle_t)data.readInt32(); |
| 1142 | audio_config_t config; |
| 1143 | data.read(&config, sizeof(audio_config_t)); |
| 1144 | audio_devices_t device = (audio_devices_t)data.readInt32(); |
| 1145 | String8 address(data.readString8()); |
| 1146 | audio_source_t source = (audio_source_t)data.readInt32(); |
Glenn Kasten | ec40d28 | 2014-07-15 15:31:26 -0700 | [diff] [blame] | 1147 | audio_input_flags_t flags = (audio_input_flags_t) data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1148 | |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 1149 | status_t status = openInput(module, &input, &config, |
| 1150 | &device, address, source, flags); |
| 1151 | reply->writeInt32((int32_t) status); |
| 1152 | if (status == NO_ERROR) { |
| 1153 | reply->writeInt32((int32_t) input); |
| 1154 | reply->write(&config, sizeof(audio_config_t)); |
| 1155 | reply->writeInt32(device); |
| 1156 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1157 | return NO_ERROR; |
| 1158 | } break; |
| 1159 | case CLOSE_INPUT: { |
| 1160 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1161 | reply->writeInt32(closeInput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1162 | return NO_ERROR; |
| 1163 | } break; |
Glenn Kasten | d2304db | 2014-02-03 07:40:31 -0800 | [diff] [blame] | 1164 | case INVALIDATE_STREAM: { |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1165 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | d2304db | 2014-02-03 07:40:31 -0800 | [diff] [blame] | 1166 | audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); |
| 1167 | reply->writeInt32(invalidateStream(stream)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1168 | return NO_ERROR; |
| 1169 | } break; |
Eric Laurent | f0ee6f4 | 2009-10-21 08:14:22 -0700 | [diff] [blame] | 1170 | case SET_VOICE_VOLUME: { |
| 1171 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1172 | float volume = data.readFloat(); |
| 1173 | reply->writeInt32( setVoiceVolume(volume) ); |
| 1174 | return NO_ERROR; |
| 1175 | } break; |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 1176 | case GET_RENDER_POSITION: { |
| 1177 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1178 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Kévin PETIT | 377b2ec | 2014-02-03 12:35:36 +0000 | [diff] [blame] | 1179 | uint32_t halFrames; |
| 1180 | uint32_t dspFrames; |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 1181 | status_t status = getRenderPosition(&halFrames, &dspFrames, output); |
| 1182 | reply->writeInt32(status); |
| 1183 | if (status == NO_ERROR) { |
| 1184 | reply->writeInt32(halFrames); |
| 1185 | reply->writeInt32(dspFrames); |
| 1186 | } |
| 1187 | return NO_ERROR; |
| 1188 | } |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 1189 | case GET_INPUT_FRAMES_LOST: { |
| 1190 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1191 | audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); |
Glenn Kasten | 5f972c0 | 2014-01-13 09:59:31 -0800 | [diff] [blame] | 1192 | reply->writeInt32((int32_t) getInputFramesLost(ioHandle)); |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 1193 | return NO_ERROR; |
| 1194 | } break; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1195 | case NEW_AUDIO_SESSION_ID: { |
| 1196 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 1197 | reply->writeInt32(newAudioUniqueId()); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1198 | return NO_ERROR; |
| 1199 | } break; |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 1200 | case ACQUIRE_AUDIO_SESSION_ID: { |
| 1201 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1202 | int audioSession = data.readInt32(); |
Marco Nelissen | d457c97 | 2014-02-11 08:47:07 -0800 | [diff] [blame] | 1203 | int pid = data.readInt32(); |
| 1204 | acquireAudioSessionId(audioSession, pid); |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 1205 | return NO_ERROR; |
| 1206 | } break; |
| 1207 | case RELEASE_AUDIO_SESSION_ID: { |
| 1208 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1209 | int audioSession = data.readInt32(); |
Marco Nelissen | d457c97 | 2014-02-11 08:47:07 -0800 | [diff] [blame] | 1210 | int pid = data.readInt32(); |
| 1211 | releaseAudioSessionId(audioSession, pid); |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 1212 | return NO_ERROR; |
| 1213 | } break; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1214 | case QUERY_NUM_EFFECTS: { |
| 1215 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1216 | uint32_t numEffects; |
| 1217 | status_t status = queryNumberEffects(&numEffects); |
| 1218 | reply->writeInt32(status); |
| 1219 | if (status == NO_ERROR) { |
| 1220 | reply->writeInt32((int32_t)numEffects); |
| 1221 | } |
| 1222 | return NO_ERROR; |
| 1223 | } |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 1224 | case QUERY_EFFECT: { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1225 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1226 | effect_descriptor_t desc; |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 1227 | status_t status = queryEffect(data.readInt32(), &desc); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1228 | reply->writeInt32(status); |
| 1229 | if (status == NO_ERROR) { |
| 1230 | reply->write(&desc, sizeof(effect_descriptor_t)); |
| 1231 | } |
| 1232 | return NO_ERROR; |
| 1233 | } |
| 1234 | case GET_EFFECT_DESCRIPTOR: { |
| 1235 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1236 | effect_uuid_t uuid; |
| 1237 | data.read(&uuid, sizeof(effect_uuid_t)); |
| 1238 | effect_descriptor_t desc; |
| 1239 | status_t status = getEffectDescriptor(&uuid, &desc); |
| 1240 | reply->writeInt32(status); |
| 1241 | if (status == NO_ERROR) { |
| 1242 | reply->write(&desc, sizeof(effect_descriptor_t)); |
| 1243 | } |
| 1244 | return NO_ERROR; |
| 1245 | } |
| 1246 | case CREATE_EFFECT: { |
| 1247 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1248 | effect_descriptor_t desc; |
| 1249 | data.read(&desc, sizeof(effect_descriptor_t)); |
| 1250 | sp<IEffectClient> client = interface_cast<IEffectClient>(data.readStrongBinder()); |
| 1251 | int32_t priority = data.readInt32(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1252 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1253 | int sessionId = data.readInt32(); |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 1254 | const String16 opPackageName = data.readString16(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1255 | status_t status; |
| 1256 | int id; |
| 1257 | int enabled; |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 1258 | |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 1259 | sp<IEffect> effect = createEffect(&desc, client, priority, output, sessionId, |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 1260 | opPackageName, &status, &id, &enabled); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1261 | reply->writeInt32(status); |
| 1262 | reply->writeInt32(id); |
| 1263 | reply->writeInt32(enabled); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 1264 | reply->writeStrongBinder(IInterface::asBinder(effect)); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1265 | reply->write(&desc, sizeof(effect_descriptor_t)); |
| 1266 | return NO_ERROR; |
| 1267 | } break; |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1268 | case MOVE_EFFECTS: { |
| 1269 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1270 | int session = data.readInt32(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1271 | audio_io_handle_t srcOutput = (audio_io_handle_t) data.readInt32(); |
| 1272 | audio_io_handle_t dstOutput = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1273 | reply->writeInt32(moveEffects(session, srcOutput, dstOutput)); |
| 1274 | return NO_ERROR; |
| 1275 | } break; |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 1276 | case LOAD_HW_MODULE: { |
| 1277 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1278 | reply->writeInt32(loadHwModule(data.readCString())); |
| 1279 | return NO_ERROR; |
| 1280 | } break; |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 1281 | case GET_PRIMARY_OUTPUT_SAMPLING_RATE: { |
| 1282 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1283 | reply->writeInt32(getPrimaryOutputSamplingRate()); |
| 1284 | return NO_ERROR; |
| 1285 | } break; |
| 1286 | case GET_PRIMARY_OUTPUT_FRAME_COUNT: { |
| 1287 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame] | 1288 | reply->writeInt64(getPrimaryOutputFrameCount()); |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 1289 | return NO_ERROR; |
| 1290 | } break; |
Glenn Kasten | 4182c4e | 2013-07-15 14:45:07 -0700 | [diff] [blame] | 1291 | case SET_LOW_RAM_DEVICE: { |
| 1292 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1293 | bool isLowRamDevice = data.readInt32() != 0; |
| 1294 | reply->writeInt32(setLowRamDevice(isLowRamDevice)); |
| 1295 | return NO_ERROR; |
| 1296 | } break; |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1297 | case LIST_AUDIO_PORTS: { |
| 1298 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1299 | unsigned int numPortsReq = data.readInt32(); |
| 1300 | if (numPortsReq > MAX_ITEMS_PER_LIST) { |
| 1301 | numPortsReq = MAX_ITEMS_PER_LIST; |
| 1302 | } |
| 1303 | unsigned int numPorts = numPortsReq; |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1304 | struct audio_port *ports = |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1305 | (struct audio_port *)calloc(numPortsReq, |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1306 | sizeof(struct audio_port)); |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1307 | if (ports == NULL) { |
| 1308 | reply->writeInt32(NO_MEMORY); |
| 1309 | reply->writeInt32(0); |
| 1310 | return NO_ERROR; |
| 1311 | } |
| 1312 | status_t status = listAudioPorts(&numPorts, ports); |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1313 | reply->writeInt32(status); |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1314 | reply->writeInt32(numPorts); |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1315 | if (status == NO_ERROR) { |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1316 | if (numPortsReq > numPorts) { |
| 1317 | numPortsReq = numPorts; |
| 1318 | } |
| 1319 | reply->write(ports, numPortsReq * sizeof(struct audio_port)); |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1320 | } |
| 1321 | free(ports); |
| 1322 | return NO_ERROR; |
| 1323 | } break; |
| 1324 | case GET_AUDIO_PORT: { |
| 1325 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1326 | struct audio_port port; |
| 1327 | data.read(&port, sizeof(struct audio_port)); |
| 1328 | status_t status = getAudioPort(&port); |
| 1329 | reply->writeInt32(status); |
| 1330 | if (status == NO_ERROR) { |
| 1331 | reply->write(&port, sizeof(struct audio_port)); |
| 1332 | } |
| 1333 | return NO_ERROR; |
| 1334 | } break; |
| 1335 | case CREATE_AUDIO_PATCH: { |
| 1336 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1337 | struct audio_patch patch; |
| 1338 | data.read(&patch, sizeof(struct audio_patch)); |
| 1339 | audio_patch_handle_t handle; |
| 1340 | data.read(&handle, sizeof(audio_patch_handle_t)); |
| 1341 | status_t status = createAudioPatch(&patch, &handle); |
| 1342 | reply->writeInt32(status); |
| 1343 | if (status == NO_ERROR) { |
| 1344 | reply->write(&handle, sizeof(audio_patch_handle_t)); |
| 1345 | } |
| 1346 | return NO_ERROR; |
| 1347 | } break; |
| 1348 | case RELEASE_AUDIO_PATCH: { |
| 1349 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1350 | audio_patch_handle_t handle; |
| 1351 | data.read(&handle, sizeof(audio_patch_handle_t)); |
| 1352 | status_t status = releaseAudioPatch(handle); |
| 1353 | reply->writeInt32(status); |
| 1354 | return NO_ERROR; |
| 1355 | } break; |
| 1356 | case LIST_AUDIO_PATCHES: { |
| 1357 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1358 | unsigned int numPatchesReq = data.readInt32(); |
| 1359 | if (numPatchesReq > MAX_ITEMS_PER_LIST) { |
| 1360 | numPatchesReq = MAX_ITEMS_PER_LIST; |
| 1361 | } |
| 1362 | unsigned int numPatches = numPatchesReq; |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1363 | struct audio_patch *patches = |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1364 | (struct audio_patch *)calloc(numPatchesReq, |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1365 | sizeof(struct audio_patch)); |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1366 | if (patches == NULL) { |
| 1367 | reply->writeInt32(NO_MEMORY); |
| 1368 | reply->writeInt32(0); |
| 1369 | return NO_ERROR; |
| 1370 | } |
| 1371 | status_t status = listAudioPatches(&numPatches, patches); |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1372 | reply->writeInt32(status); |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1373 | reply->writeInt32(numPatches); |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1374 | if (status == NO_ERROR) { |
Eric Laurent | f75c2fe | 2015-04-02 13:49:15 -0700 | [diff] [blame] | 1375 | if (numPatchesReq > numPatches) { |
| 1376 | numPatchesReq = numPatches; |
| 1377 | } |
| 1378 | reply->write(patches, numPatchesReq * sizeof(struct audio_patch)); |
Eric Laurent | 4b12340 | 2014-04-11 09:22:20 -0700 | [diff] [blame] | 1379 | } |
| 1380 | free(patches); |
| 1381 | return NO_ERROR; |
| 1382 | } break; |
| 1383 | case SET_AUDIO_PORT_CONFIG: { |
| 1384 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1385 | struct audio_port_config config; |
| 1386 | data.read(&config, sizeof(struct audio_port_config)); |
| 1387 | status_t status = setAudioPortConfig(&config); |
| 1388 | reply->writeInt32(status); |
| 1389 | return NO_ERROR; |
| 1390 | } break; |
Eric Laurent | 93c3d41 | 2014-08-01 14:48:35 -0700 | [diff] [blame] | 1391 | case GET_AUDIO_HW_SYNC: { |
| 1392 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1393 | reply->writeInt32(getAudioHwSyncForSession((audio_session_t)data.readInt32())); |
| 1394 | return NO_ERROR; |
| 1395 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1396 | default: |
| 1397 | return BBinder::onTransact(code, data, reply, flags); |
| 1398 | } |
| 1399 | } |
| 1400 | |
| 1401 | // ---------------------------------------------------------------------------- |
| 1402 | |
Glenn Kasten | 40bc906 | 2015-03-20 09:09:33 -0700 | [diff] [blame] | 1403 | } // namespace android |