Merge "BtAudio: Add InReadPcmData to middleware" am: 4909c203d1

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1955932

Change-Id: Id02876054b439aa22acbbcaaf0f477e2fd9d147b
This commit is contained in:
Treehugger Robot 2022-01-24 04:30:56 +00:00 committed by Automerger Merge Worker
commit 07333f4d70
3 changed files with 12 additions and 0 deletions

View file

@ -651,6 +651,12 @@ size_t HidlToAidlMiddleware_2_0::OutWritePcmData(
from_session_type_2_0(session_type), buffer, bytes);
}
size_t HidlToAidlMiddleware_2_0::InReadPcmData(
const SessionType_2_0& session_type, void* buffer, size_t bytes) {
return BluetoothAudioSessionControl::InReadPcmData(
from_session_type_2_0(session_type), buffer, bytes);
}
bool HidlToAidlMiddleware_2_0::IsAidlAvailable() {
return BluetoothAudioSession::IsAidlAvailable();
}

View file

@ -64,6 +64,9 @@ class HidlToAidlMiddleware_2_0 {
static size_t OutWritePcmData(const SessionType_2_0& session_type,
const void* buffer, size_t bytes);
static size_t InReadPcmData(const SessionType_2_0& session_type, void* buffer,
size_t bytes);
};
} // namespace audio

View file

@ -437,6 +437,9 @@ size_t BluetoothAudioSession::OutWritePcmData(const void* buffer,
// The control function reads stream from FMQ
size_t BluetoothAudioSession::InReadPcmData(void* buffer, size_t bytes) {
if (HidlToAidlMiddleware_2_0::IsAidlAvailable())
return HidlToAidlMiddleware_2_0::InReadPcmData(session_type_, buffer,
bytes);
if (buffer == nullptr || !bytes) return 0;
size_t totalRead = 0;
int ms_timeout = kFmqReceiveTimeoutMs;