blob: 0a51b7ef356e8f2fa32bfb3097114c8bc82885c2 [file] [log] [blame]
Andy Hung440901d2023-06-29 21:19:25 -07001/*
2 * Copyright (C) 2023 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#pragma once
18
19#include "IAfTrack.h"
20
21namespace android {
22
Andy Hung87c693c2023-07-06 20:56:16 -070023class IAfDirectOutputThread;
24class IAfDuplicatingThread;
Andy Hung7aa7d102023-07-07 15:58:48 -070025class IAfMmapCaptureThread;
26class IAfMmapPlaybackThread;
Andy Hung87c693c2023-07-06 20:56:16 -070027class IAfPlaybackThread;
28class IAfRecordThread;
29
Andy Hung440901d2023-06-29 21:19:25 -070030class IAfThreadBase : public virtual RefBase {
31public:
32 enum type_t {
33 MIXER, // Thread class is MixerThread
34 DIRECT, // Thread class is DirectOutputThread
35 DUPLICATING, // Thread class is DuplicatingThread
36 RECORD, // Thread class is RecordThread
37 OFFLOAD, // Thread class is OffloadThread
38 MMAP_PLAYBACK, // Thread class for MMAP playback stream
39 MMAP_CAPTURE, // Thread class for MMAP capture stream
40 SPATIALIZER, //
41 BIT_PERFECT, // Thread class for BitPerfectThread
42 // When adding a value, also update IAfThreadBase::threadTypeToString()
43 };
44
45 static const char* threadTypeToString(type_t type);
46 virtual status_t readyToRun() = 0;
47 virtual void clearPowerManager() = 0;
48 virtual status_t initCheck() const = 0;
49 virtual type_t type() const = 0;
50 virtual bool isDuplicating() const = 0;
51 virtual audio_io_handle_t id() const = 0;
52 virtual uint32_t sampleRate() const = 0;
53 virtual audio_channel_mask_t channelMask() const = 0;
54 virtual audio_channel_mask_t mixerChannelMask() const = 0;
55 virtual audio_format_t format() const = 0;
56 virtual uint32_t channelCount() const = 0;
57
58 // Called by AudioFlinger::frameCount(audio_io_handle_t output) and effects,
59 // and returns the [normal mix] buffer's frame count.
60 virtual size_t frameCount() const = 0;
61 virtual audio_channel_mask_t hapticChannelMask() const = 0;
Andy Hung87c693c2023-07-06 20:56:16 -070062 virtual uint32_t hapticChannelCount() const = 0;
Andy Hung440901d2023-06-29 21:19:25 -070063 virtual uint32_t latency_l() const = 0;
64 virtual void setVolumeForOutput_l(float left, float right) const = 0;
65
66 // Return's the HAL's frame count i.e. fast mixer buffer size.
67 virtual size_t frameCountHAL() const = 0;
68 virtual size_t frameSize() const = 0;
69 // Should be "virtual status_t requestExitAndWait()" and override same
70 // method in Thread, but Thread::requestExitAndWait() is not yet virtual.
71 virtual void exit() = 0;
72 virtual bool checkForNewParameter_l(const String8& keyValuePair, status_t& status) = 0;
73 virtual status_t setParameters(const String8& keyValuePairs) = 0;
74 virtual String8 getParameters(const String8& keys) = 0;
75 virtual void ioConfigChanged(
76 audio_io_config_event_t event, pid_t pid = 0,
77 audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE) = 0;
78
79 // sendConfigEvent_l() must be called with ThreadBase::mLock held
80 // Can temporarily release the lock if waiting for a reply from
81 // processConfigEvents_l().
82 // status_t sendConfigEvent_l(sp<ConfigEvent>& event);
83 virtual void sendIoConfigEvent(
84 audio_io_config_event_t event, pid_t pid = 0,
85 audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE) = 0;
86 virtual void sendIoConfigEvent_l(
87 audio_io_config_event_t event, pid_t pid = 0,
88 audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE) = 0;
89 virtual void sendPrioConfigEvent(pid_t pid, pid_t tid, int32_t prio, bool forApp) = 0;
90 virtual void sendPrioConfigEvent_l(pid_t pid, pid_t tid, int32_t prio, bool forApp) = 0;
91 virtual status_t sendSetParameterConfigEvent_l(const String8& keyValuePair) = 0;
92 virtual status_t sendCreateAudioPatchConfigEvent(
93 const struct audio_patch* patch, audio_patch_handle_t* handle) = 0;
94 virtual status_t sendReleaseAudioPatchConfigEvent(audio_patch_handle_t handle) = 0;
95 virtual status_t sendUpdateOutDeviceConfigEvent(
96 const DeviceDescriptorBaseVector& outDevices) = 0;
97 virtual void sendResizeBufferConfigEvent_l(int32_t maxSharedAudioHistoryMs) = 0;
98 virtual void sendCheckOutputStageEffectsEvent() = 0;
99 virtual void sendCheckOutputStageEffectsEvent_l() = 0;
100 virtual void sendHalLatencyModesChangedEvent_l() = 0;
101
102 virtual void processConfigEvents_l() = 0;
103 virtual void setCheckOutputStageEffects() = 0;
104 virtual void cacheParameters_l() = 0;
105 virtual status_t createAudioPatch_l(
106 const struct audio_patch* patch, audio_patch_handle_t* handle) = 0;
107 virtual status_t releaseAudioPatch_l(const audio_patch_handle_t handle) = 0;
108 virtual void updateOutDevices(const DeviceDescriptorBaseVector& outDevices) = 0;
109 virtual void toAudioPortConfig(struct audio_port_config* config) = 0;
110 virtual void resizeInputBuffer_l(int32_t maxSharedAudioHistoryMs) = 0;
111
112 // see note at declaration of mStandby, mOutDevice and mInDevice
113 virtual bool inStandby() const = 0;
114 virtual const DeviceTypeSet outDeviceTypes() const = 0;
115 virtual audio_devices_t inDeviceType() const = 0;
116 virtual DeviceTypeSet getDeviceTypes() const = 0;
117 virtual const AudioDeviceTypeAddrVector& outDeviceTypeAddrs() const = 0;
118 virtual const AudioDeviceTypeAddr& inDeviceTypeAddr() const = 0;
119 virtual bool isOutput() const = 0;
120 virtual bool isOffloadOrMmap() const = 0;
121 virtual sp<StreamHalInterface> stream() const = 0;
122 virtual sp<IAfEffectHandle> createEffect_l(
123 const sp<Client>& client,
124 const sp<media::IEffectClient>& effectClient,
125 int32_t priority,
126 audio_session_t sessionId,
127 effect_descriptor_t* desc,
128 int* enabled,
129 status_t* status /*non-NULL*/,
130 bool pinned,
131 bool probe,
132 bool notifyFramesProcessed) = 0;
133
134 // return values for hasAudioSession (bit field)
135 enum effect_state {
136 EFFECT_SESSION = 0x1, // the audio session corresponds to at least one
137 // effect
138 TRACK_SESSION = 0x2, // the audio session corresponds to at least one
139 // track
140 FAST_SESSION = 0x4, // the audio session corresponds to at least one
141 // fast track
142 SPATIALIZED_SESSION = 0x8, // the audio session corresponds to at least one
143 // spatialized track
144 BIT_PERFECT_SESSION = 0x10 // the audio session corresponds to at least one
145 // bit-perfect track
146 };
147
148 // get effect chain corresponding to session Id.
149 virtual sp<IAfEffectChain> getEffectChain(audio_session_t sessionId) const = 0;
150 // same as getEffectChain() but must be called with ThreadBase mutex locked
151 virtual sp<IAfEffectChain> getEffectChain_l(audio_session_t sessionId) const = 0;
152 virtual std::vector<int> getEffectIds_l(audio_session_t sessionId) const = 0;
153 // add an effect chain to the chain list (mEffectChains)
154 virtual status_t addEffectChain_l(const sp<IAfEffectChain>& chain) = 0;
155 // remove an effect chain from the chain list (mEffectChains)
156 virtual size_t removeEffectChain_l(const sp<IAfEffectChain>& chain) = 0;
157 // lock all effect chains Mutexes. Must be called before releasing the
158 // ThreadBase mutex before processing the mixer and effects. This guarantees the
159 // integrity of the chains during the process.
160 // Also sets the parameter 'effectChains' to current value of mEffectChains.
161 virtual void lockEffectChains_l(Vector<sp<IAfEffectChain>>& effectChains) = 0;
162 // unlock effect chains after process
163 virtual void unlockEffectChains(const Vector<sp<IAfEffectChain>>& effectChains) = 0;
164 // get a copy of mEffectChains vector
165 virtual Vector<sp<IAfEffectChain>> getEffectChains_l() const = 0;
166 // set audio mode to all effect chains
167 virtual void setMode(audio_mode_t mode) = 0;
168 // get effect module with corresponding ID on specified audio session
169 virtual sp<IAfEffectModule> getEffect(audio_session_t sessionId, int effectId) const = 0;
170 virtual sp<IAfEffectModule> getEffect_l(audio_session_t sessionId, int effectId) const = 0;
171 // add and effect module. Also creates the effect chain is none exists for
172 // the effects audio session. Only called in a context of moving an effect
173 // from one thread to another
174 virtual status_t addEffect_l(const sp<IAfEffectModule>& effect) = 0;
175 // remove and effect module. Also removes the effect chain is this was the last
176 // effect
177 virtual void removeEffect_l(const sp<IAfEffectModule>& effect, bool release = false) = 0;
178 // disconnect an effect handle from module and destroy module if last handle
179 virtual void disconnectEffectHandle(IAfEffectHandle* handle, bool unpinIfLast) = 0;
180 // detach all tracks connected to an auxiliary effect
181 virtual void detachAuxEffect_l(int effectId) = 0;
182 // returns a combination of:
183 // - EFFECT_SESSION if effects on this audio session exist in one chain
184 // - TRACK_SESSION if tracks on this audio session exist
185 // - FAST_SESSION if fast tracks on this audio session exist
186 // - SPATIALIZED_SESSION if spatialized tracks on this audio session exist
187 virtual uint32_t hasAudioSession_l(audio_session_t sessionId) const = 0;
188 virtual uint32_t hasAudioSession(audio_session_t sessionId) const = 0;
189
190 // the value returned by default implementation is not important as the
191 // strategy is only meaningful for PlaybackThread which implements this method
192 virtual product_strategy_t getStrategyForSession_l(audio_session_t sessionId) const = 0;
193
194 // check if some effects must be suspended/restored when an effect is enabled
195 // or disabled
196 virtual void checkSuspendOnEffectEnabled(
197 bool enabled, audio_session_t sessionId, bool threadLocked) = 0;
198
199 virtual status_t setSyncEvent(const sp<audioflinger::SyncEvent>& event) = 0;
200 virtual bool isValidSyncEvent(const sp<audioflinger::SyncEvent>& event) const = 0;
201
202 // Return a reference to a per-thread heap which can be used to allocate IMemory
203 // objects that will be read-only to client processes, read/write to mediaserver,
204 // and shared by all client processes of the thread.
205 // The heap is per-thread rather than common across all threads, because
206 // clients can't be trusted not to modify the offset of the IMemory they receive.
207 // If a thread does not have such a heap, this method returns 0.
208 virtual sp<MemoryDealer> readOnlyHeap() const = 0;
209
210 virtual sp<IMemory> pipeMemory() const = 0;
211
212 virtual void systemReady() = 0;
213
214 // checkEffectCompatibility_l() must be called with ThreadBase::mLock held
215 virtual status_t checkEffectCompatibility_l(
216 const effect_descriptor_t* desc, audio_session_t sessionId) = 0;
217
218 virtual void broadcast_l() = 0;
219
220 virtual bool isTimestampCorrectionEnabled() const = 0;
221
222 virtual bool isMsdDevice() const = 0;
223
224 virtual void dump(int fd, const Vector<String16>& args) = 0;
225
226 // deliver stats to mediametrics.
227 virtual void sendStatistics(bool force) = 0;
228
229 virtual Mutex& mutex() const = 0;
230
231 virtual void onEffectEnable(const sp<IAfEffectModule>& effect) = 0;
232 virtual void onEffectDisable() = 0;
233
234 // invalidateTracksForAudioSession_l must be called with holding mLock.
235 virtual void invalidateTracksForAudioSession_l(audio_session_t sessionId) const = 0;
236 // Invalidate all the tracks with the given audio session.
237 virtual void invalidateTracksForAudioSession(audio_session_t sessionId) const = 0;
238
239 virtual bool isStreamInitialized() const = 0;
240 virtual void startMelComputation_l(const sp<audio_utils::MelProcessor>& processor) = 0;
241 virtual void stopMelComputation_l() = 0;
242
243 virtual product_strategy_t getStrategyForStream(audio_stream_type_t stream) const = 0;
Andy Hung87c693c2023-07-06 20:56:16 -0700244
245 virtual void setEffectSuspended_l(
246 const effect_uuid_t* type, bool suspend, audio_session_t sessionId) = 0;
247
248 // Dynamic cast to derived interface
249 virtual sp<IAfDirectOutputThread> asIAfDirectOutputThread() { return nullptr; }
250 virtual sp<IAfDuplicatingThread> asIAfDuplicatingThread() { return nullptr; }
251 virtual sp<IAfPlaybackThread> asIAfPlaybackThread() { return nullptr; }
252 virtual sp<IAfRecordThread> asIAfRecordThread() { return nullptr; }
253 virtual AudioFlinger* audioFlinger() const = 0;
Andy Hung440901d2023-06-29 21:19:25 -0700254};
255
Andy Hung87c693c2023-07-06 20:56:16 -0700256class IAfPlaybackThread : public virtual IAfThreadBase, public virtual VolumeInterface {
Andy Hung440901d2023-06-29 21:19:25 -0700257public:
Andy Hung87c693c2023-07-06 20:56:16 -0700258 static constexpr int8_t kMaxTrackStopRetriesOffload = 2;
259
Andy Hung440901d2023-06-29 21:19:25 -0700260 enum mixer_state {
261 MIXER_IDLE, // no active tracks
262 MIXER_TRACKS_ENABLED, // at least one active track, but no track has any data ready
263 MIXER_TRACKS_READY, // at least one active track, and at least one track has data
264 MIXER_DRAIN_TRACK, // drain currently playing track
265 MIXER_DRAIN_ALL, // fully drain the hardware
266 // standby mode does not have an enum value
267 // suspend by audio policy manager is orthogonal to mixer state
268 };
269
270 // return estimated latency in milliseconds, as reported by HAL
271 virtual uint32_t latency() const = 0; // should be in IAfThreadBase?
272
Andy Hung87c693c2023-07-06 20:56:16 -0700273 virtual uint32_t& fastTrackAvailMask_l() = 0;
274
Andy Hung440901d2023-06-29 21:19:25 -0700275 virtual sp<IAfTrack> createTrack_l(
276 const sp<Client>& client,
277 audio_stream_type_t streamType,
278 const audio_attributes_t& attr,
279 uint32_t* sampleRate,
280 audio_format_t format,
281 audio_channel_mask_t channelMask,
282 size_t* pFrameCount,
283 size_t* pNotificationFrameCount,
284 uint32_t notificationsPerBuffer,
285 float speed,
286 const sp<IMemory>& sharedBuffer,
287 audio_session_t sessionId,
288 audio_output_flags_t* flags,
289 pid_t creatorPid,
290 const AttributionSourceState& attributionSource,
291 pid_t tid,
292 status_t* status /*non-NULL*/,
293 audio_port_handle_t portId,
294 const sp<media::IAudioTrackCallback>& callback,
295 bool isSpatialized,
296 bool isBitPerfect) = 0;
297
Andy Hung87c693c2023-07-06 20:56:16 -0700298 virtual status_t addTrack_l(const sp<IAfTrack>& track) = 0;
299 virtual bool destroyTrack_l(const sp<IAfTrack>& track) = 0;
300 virtual bool isTrackActive(const sp<IAfTrack>& track) const = 0;
301 virtual void addOutputTrack_l(const sp<IAfTrack>& track) = 0;
302
303 virtual AudioStreamOut* getOutput_l() const = 0;
Andy Hung440901d2023-06-29 21:19:25 -0700304 virtual AudioStreamOut* getOutput() const = 0;
305 virtual AudioStreamOut* clearOutput() = 0;
Andy Hung440901d2023-06-29 21:19:25 -0700306
307 // a very large number of suspend() will eventually wraparound, but unlikely
308 virtual void suspend() = 0;
309 virtual void restore() = 0;
310 virtual bool isSuspended() const = 0;
311 virtual status_t getRenderPosition(uint32_t* halFrames, uint32_t* dspFrames) const = 0;
312 // Consider also removing and passing an explicit mMainBuffer initialization
313 // parameter to AF::IAfTrack::Track().
314 virtual float* sinkBuffer() const = 0;
315
316 virtual status_t attachAuxEffect(const sp<IAfTrack>& track, int EffectId) = 0;
317 virtual status_t attachAuxEffect_l(const sp<IAfTrack>& track, int EffectId) = 0;
318
319 // called with AudioFlinger lock held
320 virtual bool invalidateTracks_l(audio_stream_type_t streamType) = 0;
321 virtual bool invalidateTracks_l(std::set<audio_port_handle_t>& portIds) = 0;
322 virtual void invalidateTracks(audio_stream_type_t streamType) = 0;
323 // Invalidate tracks by a set of port ids. The port id will be removed from
324 // the given set if the corresponding track is found and invalidated.
325 virtual void invalidateTracks(std::set<audio_port_handle_t>& portIds) = 0;
326
327 virtual status_t getTimestamp_l(AudioTimestamp& timestamp) = 0;
328 virtual void addPatchTrack(const sp<IAfPatchTrack>& track) = 0;
329 virtual void deletePatchTrack(const sp<IAfPatchTrack>& track) = 0;
330
331 // Return the asynchronous signal wait time.
332 virtual int64_t computeWaitTimeNs_l() const = 0;
333 // returns true if the track is allowed to be added to the thread.
334 virtual bool isTrackAllowed_l(
335 audio_channel_mask_t channelMask, audio_format_t format, audio_session_t sessionId,
336 uid_t uid) const = 0;
337
338 virtual bool supportsHapticPlayback() const = 0;
339
340 virtual void setDownStreamPatch(const struct audio_patch* patch) = 0;
341
342 virtual IAfTrack* getTrackById_l(audio_port_handle_t trackId) = 0;
343
344 virtual bool hasMixer() const = 0;
345
346 virtual status_t setRequestedLatencyMode(audio_latency_mode_t mode) = 0;
347
348 virtual status_t getSupportedLatencyModes(std::vector<audio_latency_mode_t>* modes) = 0;
349
350 virtual status_t setBluetoothVariableLatencyEnabled(bool enabled) = 0;
351
352 virtual void setStandby() = 0;
353 virtual void setStandby_l() = 0;
354 virtual bool waitForHalStart() = 0;
355
356 virtual bool hasFastMixer() const = 0;
357 virtual FastTrackUnderruns getFastTrackUnderruns(size_t fastIndex) const = 0;
358 virtual const std::atomic<int64_t>& framesWritten() const = 0;
Andy Hung87c693c2023-07-06 20:56:16 -0700359
360 virtual bool usesHwAvSync() const = 0;
361};
362
363class IAfDirectOutputThread : public virtual IAfPlaybackThread {
364public:
365 virtual status_t selectPresentation(int presentationId, int programId) = 0;
366};
367
368class IAfDuplicatingThread : public virtual IAfPlaybackThread {
369public:
370 virtual void addOutputTrack(IAfPlaybackThread* thread) = 0;
371 virtual uint32_t waitTimeMs() const = 0;
372 virtual void removeOutputTrack(IAfPlaybackThread* thread) = 0;
373};
374
375class IAfRecordThread : public virtual IAfThreadBase {
376public:
377 static sp<IAfRecordThread> create(
378 const sp<AudioFlinger>& audioFlinger, AudioStreamIn* input, audio_io_handle_t id,
379 bool systemReady);
380
381 virtual sp<IAfRecordTrack> createRecordTrack_l(
382 const sp<Client>& client,
383 const audio_attributes_t& attr,
384 uint32_t* pSampleRate,
385 audio_format_t format,
386 audio_channel_mask_t channelMask,
387 size_t* pFrameCount,
388 audio_session_t sessionId,
389 size_t* pNotificationFrameCount,
390 pid_t creatorPid,
391 const AttributionSourceState& attributionSource,
392 audio_input_flags_t* flags,
393 pid_t tid,
394 status_t* status /*non-NULL*/,
395 audio_port_handle_t portId,
396 int32_t maxSharedAudioHistoryMs) = 0;
397 virtual void destroyTrack_l(const sp<IAfRecordTrack>& track) = 0;
398 virtual void removeTrack_l(const sp<IAfRecordTrack>& track) = 0;
399
400 virtual status_t start(
401 IAfRecordTrack* recordTrack, AudioSystem::sync_event_t event,
402 audio_session_t triggerSession) = 0;
403
404 // ask the thread to stop the specified track, and
405 // return true if the caller should then do it's part of the stopping process
406 virtual bool stop(IAfRecordTrack* recordTrack) = 0;
407
408 virtual AudioStreamIn* getInput() const = 0;
409 virtual AudioStreamIn* clearInput() = 0;
410
411 virtual status_t getActiveMicrophones(
412 std::vector<media::MicrophoneInfoFw>* activeMicrophones) const = 0;
413 virtual status_t setPreferredMicrophoneDirection(audio_microphone_direction_t direction) = 0;
414 virtual status_t setPreferredMicrophoneFieldDimension(float zoom) = 0;
415
416 virtual void addPatchTrack(const sp<IAfPatchRecord>& record) = 0;
417 virtual void deletePatchTrack(const sp<IAfPatchRecord>& record) = 0;
418 virtual bool fastTrackAvailable() const = 0;
419 virtual void setFastTrackAvailable(bool available) = 0;
420
421 virtual void setRecordSilenced(audio_port_handle_t portId, bool silenced) = 0;
422 virtual bool hasFastCapture() const = 0;
423
424 virtual void checkBtNrec() = 0;
425 virtual uint32_t getInputFramesLost() const = 0;
426
427 virtual status_t shareAudioHistory(
428 const std::string& sharedAudioPackageName,
429 audio_session_t sharedSessionId = AUDIO_SESSION_NONE,
430 int64_t sharedAudioStartMs = -1) = 0;
431 virtual void resetAudioHistory_l() = 0;
Andy Hung440901d2023-06-29 21:19:25 -0700432};
433
Andy Hung7aa7d102023-07-07 15:58:48 -0700434class IAfMmapThread : public virtual IAfThreadBase {
435public:
436 // createIAudioTrackAdapter() is a static constructor which creates an
437 // MmapStreamInterface AIDL interface adapter from the MmapThread object that
438 // may be passed back to the client.
439 //
440 // Only one AIDL MmapStreamInterface interface adapter should be created per MmapThread.
441 static sp<MmapStreamInterface> createMmapStreamInterfaceAdapter(
442 const sp<IAfMmapThread>& mmapThread);
443
444 virtual void configure(
445 const audio_attributes_t* attr,
446 audio_stream_type_t streamType,
447 audio_session_t sessionId,
448 const sp<MmapStreamCallback>& callback,
449 audio_port_handle_t deviceId,
450 audio_port_handle_t portId) = 0;
451 virtual void disconnect() = 0;
452
453 // MmapStreamInterface handling (see adapter)
454 virtual status_t createMmapBuffer(
455 int32_t minSizeFrames, struct audio_mmap_buffer_info* info) = 0;
456 virtual status_t getMmapPosition(struct audio_mmap_position* position) const = 0;
457 virtual status_t start(
458 const AudioClient& client, const audio_attributes_t* attr,
459 audio_port_handle_t* handle) = 0;
460 virtual status_t stop(audio_port_handle_t handle) = 0;
461 virtual status_t standby() = 0;
462 virtual status_t getExternalPosition(uint64_t* position, int64_t* timeNanos) const = 0;
463 virtual status_t reportData(const void* buffer, size_t frameCount) = 0;
464
465 // TODO(b/288339104) move to IAfThreadBase?
466 virtual void invalidateTracks(std::set<audio_port_handle_t>& portIds) = 0;
467
468 // Sets the UID records silence - TODO(b/288339104) move to IAfMmapCaptureThread
469 virtual void setRecordSilenced(audio_port_handle_t portId, bool silenced) = 0;
470
471 virtual sp<IAfMmapPlaybackThread> asIAfMmapPlaybackThread() { return nullptr; }
472 virtual sp<IAfMmapCaptureThread> asIAfMmapCaptureThread() { return nullptr; }
473};
474
475class IAfMmapPlaybackThread : public virtual IAfMmapThread, public virtual VolumeInterface {
476public:
477 virtual AudioStreamOut* clearOutput() = 0;
478};
479
480class IAfMmapCaptureThread : public virtual IAfMmapThread {
481public:
482 virtual AudioStreamIn* clearInput() = 0;
483};
484
Andy Hung440901d2023-06-29 21:19:25 -0700485} // namespace android