blob: aabf60fac34ebf2ef24876389b9c42de248c309e [file] [log] [blame]
Mikhail Naganovb03b5c42023-07-26 13:13:35 -07001/*
2 * Copyright 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#define LOG_TAG "AHAL_BluetoothPortProxy"
18
19#include <android-base/logging.h>
20#include <android-base/stringprintf.h>
21#include <audio_utils/primitives.h>
22#include <inttypes.h>
23#include <log/log.h>
24
25#include "core-impl/DevicePortProxy.h"
26
27namespace android::bluetooth::audio::aidl {
28
29namespace {
30
31// The maximum time to wait in std::condition_variable::wait_for()
32constexpr unsigned int kMaxWaitingTimeMs = 4500;
33
34} // namespace
35
36using ::aidl::android::hardware::audio::common::SinkMetadata;
37using ::aidl::android::hardware::audio::common::SourceMetadata;
38using ::aidl::android::hardware::bluetooth::audio::AudioConfiguration;
39using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioSessionControl;
40using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioStatus;
41using ::aidl::android::hardware::bluetooth::audio::ChannelMode;
42using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration;
43using ::aidl::android::hardware::bluetooth::audio::PortStatusCallbacks;
44using ::aidl::android::hardware::bluetooth::audio::PresentationPosition;
45using ::aidl::android::hardware::bluetooth::audio::SessionType;
46using ::aidl::android::media::audio::common::AudioDeviceDescription;
47using ::aidl::android::media::audio::common::AudioDeviceType;
48using ::android::base::StringPrintf;
49
50std::ostream& operator<<(std::ostream& os, const BluetoothStreamState& state) {
51 switch (state) {
52 case BluetoothStreamState::DISABLED:
53 return os << "DISABLED";
54 case BluetoothStreamState::STANDBY:
55 return os << "STANDBY";
56 case BluetoothStreamState::STARTING:
57 return os << "STARTING";
58 case BluetoothStreamState::STARTED:
59 return os << "STARTED";
60 case BluetoothStreamState::SUSPENDING:
61 return os << "SUSPENDING";
62 case BluetoothStreamState::UNKNOWN:
63 return os << "UNKNOWN";
64 default:
65 return os << android::base::StringPrintf("%#hhx", state);
66 }
67}
68
69BluetoothAudioPortAidl::BluetoothAudioPortAidl()
70 : mCookie(::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined),
71 mState(BluetoothStreamState::DISABLED),
72 mSessionType(SessionType::UNKNOWN) {}
73
74BluetoothAudioPortAidl::~BluetoothAudioPortAidl() {
75 unregisterPort();
76}
77
78bool BluetoothAudioPortAidl::registerPort(const AudioDeviceDescription& description) {
79 if (inUse()) {
80 LOG(ERROR) << __func__ << debugMessage() << " already in use";
81 return false;
82 }
83
84 if (!initSessionType(description)) return false;
85
86 auto control_result_cb = [port = this](uint16_t cookie, bool start_resp,
87 const BluetoothAudioStatus& status) {
88 (void)start_resp;
89 port->controlResultHandler(cookie, status);
90 };
91 auto session_changed_cb = [port = this](uint16_t cookie) {
92 port->sessionChangedHandler(cookie);
93 };
94 // TODO: Add audio_config_changed_cb
95 PortStatusCallbacks cbacks = {
96 .control_result_cb_ = control_result_cb,
97 .session_changed_cb_ = session_changed_cb,
98 };
99 mCookie = BluetoothAudioSessionControl::RegisterControlResultCback(mSessionType, cbacks);
100 auto isOk = (mCookie != ::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined);
101 if (isOk) {
102 std::lock_guard guard(mCvMutex);
103 mState = BluetoothStreamState::STANDBY;
104 }
105 LOG(DEBUG) << __func__ << debugMessage();
106 return isOk;
107}
108
109bool BluetoothAudioPortAidl::initSessionType(const AudioDeviceDescription& description) {
110 if (description.connection == AudioDeviceDescription::CONNECTION_BT_A2DP &&
111 (description.type == AudioDeviceType::OUT_DEVICE ||
112 description.type == AudioDeviceType::OUT_HEADPHONE ||
113 description.type == AudioDeviceType::OUT_SPEAKER)) {
114 LOG(VERBOSE) << __func__
115 << ": device=AUDIO_DEVICE_OUT_BLUETOOTH_A2DP (HEADPHONES/SPEAKER) ("
116 << description.toString() << ")";
117 mSessionType = SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH;
118 } else if (description.connection == AudioDeviceDescription::CONNECTION_WIRELESS &&
119 description.type == AudioDeviceType::OUT_HEARING_AID) {
120 LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_HEARING_AID (MEDIA/VOICE) ("
121 << description.toString() << ")";
122 mSessionType = SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH;
123 } else if (description.connection == AudioDeviceDescription::CONNECTION_BT_LE &&
124 description.type == AudioDeviceType::OUT_HEADSET) {
125 LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_BLE_HEADSET (MEDIA/VOICE) ("
126 << description.toString() << ")";
127 mSessionType = SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
128 } else if (description.connection == AudioDeviceDescription::CONNECTION_BT_LE &&
129 description.type == AudioDeviceType::OUT_SPEAKER) {
130 LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_BLE_SPEAKER (MEDIA) ("
131 << description.toString() << ")";
132 mSessionType = SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
133 } else if (description.connection == AudioDeviceDescription::CONNECTION_BT_LE &&
134 description.type == AudioDeviceType::IN_HEADSET) {
135 LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_IN_BLE_HEADSET (VOICE) ("
136 << description.toString() << ")";
137 mSessionType = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH;
138 } else if (description.connection == AudioDeviceDescription::CONNECTION_BT_LE &&
139 description.type == AudioDeviceType::OUT_BROADCAST) {
140 LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_BLE_BROADCAST (MEDIA) ("
141 << description.toString() << ")";
142 mSessionType = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH;
143 } else {
144 LOG(ERROR) << __func__ << ": unknown device=" << description.toString();
145 return false;
146 }
147
148 if (!BluetoothAudioSessionControl::IsSessionReady(mSessionType)) {
149 LOG(ERROR) << __func__ << ": device=" << description.toString()
150 << ", session_type=" << toString(mSessionType) << " is not ready";
151 return false;
152 }
153 return true;
154}
155
156void BluetoothAudioPortAidl::unregisterPort() {
157 if (!inUse()) {
158 LOG(WARNING) << __func__ << ": BluetoothAudioPortAidl is not in use";
159 return;
160 }
161 BluetoothAudioSessionControl::UnregisterControlResultCback(mSessionType, mCookie);
162 mCookie = ::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined;
163 LOG(VERBOSE) << __func__ << debugMessage() << " port unregistered";
164}
165
166void BluetoothAudioPortAidl::controlResultHandler(uint16_t cookie,
167 const BluetoothAudioStatus& status) {
168 std::lock_guard guard(mCvMutex);
169 if (!inUse()) {
170 LOG(ERROR) << "control_result_cb: BluetoothAudioPortAidl is not in use";
171 return;
172 }
173 if (mCookie != cookie) {
174 LOG(ERROR) << "control_result_cb: proxy of device port (cookie="
175 << StringPrintf("%#hx", cookie) << ") is corrupted";
176 return;
177 }
178 BluetoothStreamState previous_state = mState;
179 LOG(INFO) << "control_result_cb:" << debugMessage() << ", previous_state=" << previous_state
180 << ", status=" << toString(status);
181
182 switch (previous_state) {
183 case BluetoothStreamState::STARTED:
184 /* Only Suspend signal can be send in STARTED state*/
185 if (status == BluetoothAudioStatus::RECONFIGURATION ||
186 status == BluetoothAudioStatus::SUCCESS) {
187 mState = BluetoothStreamState::STANDBY;
188 } else {
189 LOG(WARNING) << StringPrintf(
190 "control_result_cb: status=%s failure for session_type= %s, cookie=%#hx, "
191 "previous_state=%#hhx",
192 toString(status).c_str(), toString(mSessionType).c_str(), mCookie,
193 previous_state);
194 }
195 break;
196 case BluetoothStreamState::STARTING:
197 if (status == BluetoothAudioStatus::SUCCESS) {
198 mState = BluetoothStreamState::STARTED;
199 } else {
200 // Set to standby since the stack may be busy switching between outputs
201 LOG(WARNING) << StringPrintf(
202 "control_result_cb: status=%s failure for session_type= %s, cookie=%#hx, "
203 "previous_state=%#hhx",
204 toString(status).c_str(), toString(mSessionType).c_str(), mCookie,
205 previous_state);
206 mState = BluetoothStreamState::STANDBY;
207 }
208 break;
209 case BluetoothStreamState::SUSPENDING:
210 if (status == BluetoothAudioStatus::SUCCESS) {
211 mState = BluetoothStreamState::STANDBY;
212 } else {
213 // It will be failed if the headset is disconnecting, and set to disable
214 // to wait for re-init again
215 LOG(WARNING) << StringPrintf(
216 "control_result_cb: status=%s failure for session_type= %s, cookie=%#hx, "
217 "previous_state=%#hhx",
218 toString(status).c_str(), toString(mSessionType).c_str(), mCookie,
219 previous_state);
220 mState = BluetoothStreamState::DISABLED;
221 }
222 break;
223 default:
224 LOG(ERROR) << "control_result_cb: unexpected previous_state="
225 << StringPrintf(
226 "control_result_cb: status=%s failure for session_type= %s, "
227 "cookie=%#hx, previous_state=%#hhx",
228 toString(status).c_str(), toString(mSessionType).c_str(), mCookie,
229 previous_state);
230 return;
231 }
232 mInternalCv.notify_all();
233}
234
235void BluetoothAudioPortAidl::sessionChangedHandler(uint16_t cookie) {
236 std::lock_guard guard(mCvMutex);
237 if (!inUse()) {
238 LOG(ERROR) << "session_changed_cb: BluetoothAudioPortAidl is not in use";
239 return;
240 }
241 if (mCookie != cookie) {
242 LOG(ERROR) << "session_changed_cb: proxy of device port (cookie="
243 << StringPrintf("%#hx", cookie) << ") is corrupted";
244 return;
245 }
246 BluetoothStreamState previous_state = mState;
247 LOG(VERBOSE) << "session_changed_cb:" << debugMessage()
248 << ", previous_state=" << previous_state;
249 mState = BluetoothStreamState::DISABLED;
250 mInternalCv.notify_all();
251}
252
253bool BluetoothAudioPortAidl::inUse() const {
254 return (mCookie != ::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined);
255}
256
257bool BluetoothAudioPortAidl::getPreferredDataIntervalUs(size_t* interval_us) const {
258 if (!interval_us) {
259 LOG(ERROR) << __func__ << ": bad input arg";
260 return false;
261 }
262
263 if (!inUse()) {
264 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
265 return false;
266 }
267
268 const AudioConfiguration& hal_audio_cfg =
269 BluetoothAudioSessionControl::GetAudioConfig(mSessionType);
270 if (hal_audio_cfg.getTag() != AudioConfiguration::pcmConfig) {
271 LOG(ERROR) << __func__ << ": unsupported audio cfg tag";
272 return false;
273 }
274
275 *interval_us = hal_audio_cfg.get<AudioConfiguration::pcmConfig>().dataIntervalUs;
276 return true;
277}
278
279bool BluetoothAudioPortAidl::loadAudioConfig(PcmConfiguration* audio_cfg) const {
280 if (!audio_cfg) {
281 LOG(ERROR) << __func__ << ": bad input arg";
282 return false;
283 }
284
285 if (!inUse()) {
286 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
287 return false;
288 }
289
290 const AudioConfiguration& hal_audio_cfg =
291 BluetoothAudioSessionControl::GetAudioConfig(mSessionType);
292 if (hal_audio_cfg.getTag() != AudioConfiguration::pcmConfig) {
293 LOG(ERROR) << __func__ << ": unsupported audio cfg tag";
294 return false;
295 }
296 *audio_cfg = hal_audio_cfg.get<AudioConfiguration::pcmConfig>();
297 LOG(VERBOSE) << __func__ << debugMessage() << ", state*=" << getState() << ", PcmConfig=["
298 << audio_cfg->toString() << "]";
299 if (audio_cfg->channelMode == ChannelMode::UNKNOWN) {
300 return false;
301 }
302 return true;
303}
304
305bool BluetoothAudioPortAidl::condWaitState(BluetoothStreamState state) {
306 const auto waitTime = std::chrono::milliseconds(kMaxWaitingTimeMs);
307 std::unique_lock lock(mCvMutex);
308 base::ScopedLockAssertion lock_assertion(mCvMutex);
309 switch (state) {
310 case BluetoothStreamState::STARTING: {
311 LOG(VERBOSE) << __func__ << debugMessage() << " waiting for STARTED";
312 mInternalCv.wait_for(lock, waitTime, [this] {
313 base::ScopedLockAssertion lock_assertion(mCvMutex);
314 return mState != BluetoothStreamState::STARTING;
315 });
316 return mState == BluetoothStreamState::STARTED;
317 }
318 case BluetoothStreamState::SUSPENDING: {
319 LOG(VERBOSE) << __func__ << debugMessage() << " waiting for SUSPENDED";
320 mInternalCv.wait_for(lock, waitTime, [this] {
321 base::ScopedLockAssertion lock_assertion(mCvMutex);
322 return mState != BluetoothStreamState::SUSPENDING;
323 });
324 return mState == BluetoothStreamState::STANDBY;
325 }
326 default:
327 LOG(WARNING) << __func__ << debugMessage() << " waiting for KNOWN";
328 return false;
329 }
330 return false;
331}
332
333bool BluetoothAudioPortAidl::start() {
334 if (!inUse()) {
335 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
336 return false;
337 }
338 LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState()
339 << ", mono=" << (mIsStereoToMono ? "true" : "false") << " request";
340
341 {
342 std::unique_lock lock(mCvMutex);
343 base::ScopedLockAssertion lock_assertion(mCvMutex);
344 if (mState == BluetoothStreamState::STARTED) {
345 return true; // nop, return
346 } else if (mState == BluetoothStreamState::SUSPENDING ||
347 mState == BluetoothStreamState::STARTING) {
348 /* If port is in transient state, give some time to respond */
349 auto state_ = mState;
350 lock.unlock();
351 if (!condWaitState(state_)) {
352 LOG(ERROR) << __func__ << debugMessage() << ", state=" << getState() << " failure";
353 return false;
354 }
355 }
356 }
357
358 bool retval = false;
359 {
360 std::unique_lock lock(mCvMutex);
361 base::ScopedLockAssertion lock_assertion(mCvMutex);
362 if (mState == BluetoothStreamState::STARTED) {
363 retval = true;
364 } else if (mState == BluetoothStreamState::STANDBY) {
365 mState = BluetoothStreamState::STARTING;
366 lock.unlock();
367 if (BluetoothAudioSessionControl::StartStream(mSessionType)) {
368 retval = condWaitState(BluetoothStreamState::STARTING);
369 } else {
370 LOG(ERROR) << __func__ << debugMessage() << ", state=" << getState()
371 << " Hal fails";
372 }
373 }
374 }
375
376 if (retval) {
377 LOG(INFO) << __func__ << debugMessage() << ", state=" << getState()
378 << ", mono=" << (mIsStereoToMono ? "true" : "false") << " done";
379 } else {
380 LOG(ERROR) << __func__ << debugMessage() << ", state=" << getState() << " failure";
381 }
382
383 return retval; // false if any failure like timeout
384}
385
386bool BluetoothAudioPortAidl::suspend() {
387 if (!inUse()) {
388 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
389 return false;
390 }
391 LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState() << " request";
392
393 {
394 std::unique_lock lock(mCvMutex);
395 base::ScopedLockAssertion lock_assertion(mCvMutex);
396 if (mState == BluetoothStreamState::STANDBY) {
397 return true; // nop, return
398 } else if (mState == BluetoothStreamState::SUSPENDING ||
399 mState == BluetoothStreamState::STARTING) {
400 /* If port is in transient state, give some time to respond */
401 auto state_ = mState;
402 lock.unlock();
403 if (!condWaitState(state_)) {
404 LOG(ERROR) << __func__ << debugMessage() << ", state=" << getState() << " failure";
405 return false;
406 }
407 }
408 }
409
410 bool retval = false;
411 {
412 std::unique_lock lock(mCvMutex);
413 base::ScopedLockAssertion lock_assertion(mCvMutex);
414 if (mState == BluetoothStreamState::STANDBY) {
415 retval = true;
416 } else if (mState == BluetoothStreamState::STARTED) {
417 mState = BluetoothStreamState::SUSPENDING;
418 lock.unlock();
419 if (BluetoothAudioSessionControl::SuspendStream(mSessionType)) {
420 retval = condWaitState(BluetoothStreamState::SUSPENDING);
421 } else {
422 LOG(ERROR) << __func__ << debugMessage() << ", state=" << getState()
423 << " Hal fails";
424 }
425 }
426 }
427
428 if (retval) {
429 LOG(INFO) << __func__ << debugMessage() << ", state=" << getState() << " done";
430 } else {
431 LOG(ERROR) << __func__ << debugMessage() << ", state=" << getState() << " failure";
432 }
433
434 return retval; // false if any failure like timeout
435}
436
437void BluetoothAudioPortAidl::stop() {
438 if (!inUse()) {
439 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
440 return;
441 }
442 std::lock_guard guard(mCvMutex);
443 LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState() << " request";
444 if (mState != BluetoothStreamState::DISABLED) {
445 BluetoothAudioSessionControl::StopStream(mSessionType);
446 mState = BluetoothStreamState::DISABLED;
447 }
448 LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState() << " done";
449}
450
451size_t BluetoothAudioPortAidlOut::writeData(const void* buffer, size_t bytes) const {
452 if (!buffer) {
453 LOG(ERROR) << __func__ << ": bad input arg";
454 return 0;
455 }
456
457 if (!inUse()) {
458 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
459 return 0;
460 }
461
462 if (!mIsStereoToMono) {
463 return BluetoothAudioSessionControl::OutWritePcmData(mSessionType, buffer, bytes);
464 }
465
466 // WAR to mix the stereo into Mono (16 bits per sample)
467 const size_t write_frames = bytes >> 2;
468 if (write_frames == 0) return 0;
469 auto src = static_cast<const int16_t*>(buffer);
470 std::unique_ptr<int16_t[]> dst{new int16_t[write_frames]};
471 downmix_to_mono_i16_from_stereo_i16(dst.get(), src, write_frames);
472 // a frame is 16 bits, and the size of a mono frame is equal to half a stereo.
473 auto totalWrite = BluetoothAudioSessionControl::OutWritePcmData(mSessionType, dst.get(),
474 write_frames * 2);
475 return totalWrite * 2;
476}
477
478size_t BluetoothAudioPortAidlIn::readData(void* buffer, size_t bytes) const {
479 if (!buffer) {
480 LOG(ERROR) << __func__ << ": bad input arg";
481 return 0;
482 }
483
484 if (!inUse()) {
485 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
486 return 0;
487 }
488
489 return BluetoothAudioSessionControl::InReadPcmData(mSessionType, buffer, bytes);
490}
491
492bool BluetoothAudioPortAidl::getPresentationPosition(
493 PresentationPosition& presentation_position) const {
494 if (!inUse()) {
495 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
496 return false;
497 }
498 bool retval = BluetoothAudioSessionControl::GetPresentationPosition(mSessionType,
499 presentation_position);
500 LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState()
501 << presentation_position.toString();
502
503 return retval;
504}
505
506bool BluetoothAudioPortAidl::updateSourceMetadata(const SourceMetadata& source_metadata) const {
507 if (!inUse()) {
508 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
509 return false;
510 }
511 LOG(DEBUG) << __func__ << debugMessage() << ", state=" << getState() << ", "
512 << source_metadata.tracks.size() << " track(s)";
513 if (source_metadata.tracks.size() == 0) return true;
514 return BluetoothAudioSessionControl::UpdateSourceMetadata(mSessionType, source_metadata);
515}
516
517bool BluetoothAudioPortAidl::updateSinkMetadata(const SinkMetadata& sink_metadata) const {
518 if (!inUse()) {
519 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
520 return false;
521 }
522 LOG(DEBUG) << __func__ << debugMessage() << ", state=" << getState() << ", "
523 << sink_metadata.tracks.size() << " track(s)";
524 if (sink_metadata.tracks.size() == 0) return true;
525 return BluetoothAudioSessionControl::UpdateSinkMetadata(mSessionType, sink_metadata);
526}
527
528BluetoothStreamState BluetoothAudioPortAidl::getState() const {
529 return mState;
530}
531
532bool BluetoothAudioPortAidl::setState(BluetoothStreamState state) {
533 if (!inUse()) {
534 LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
535 return false;
536 }
537 std::lock_guard guard(mCvMutex);
538 LOG(DEBUG) << __func__ << ": BluetoothAudioPortAidl old state = " << mState
539 << " new state = " << state;
540 mState = state;
541 return true;
542}
543
544bool BluetoothAudioPortAidl::isA2dp() const {
545 return mSessionType == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
546 mSessionType == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
547}
548
549bool BluetoothAudioPortAidl::isLeAudio() const {
550 return mSessionType == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
551 mSessionType == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH ||
552 mSessionType == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
553 mSessionType == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
554 mSessionType == SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH ||
555 mSessionType == SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
556}
557
558std::string BluetoothAudioPortAidl::debugMessage() const {
559 return StringPrintf(": session_type=%s, cookie=%#hx", toString(mSessionType).c_str(), mCookie);
560}
561
562} // namespace android::bluetooth::audio::aidl