BtAudio: Add InReadPcmData to middleware

Bug: 203490261
Test: m android.hardware.bluetooth.audio-V1-impl
Change-Id: I330226ecc38368b3838c01a191b66b700a2338a7
This commit is contained in:
Josh Wu
2022-01-21 20:49:49 -08:00
parent d4dcde3bc1
commit 9880f6bb3c
3 changed files with 12 additions and 0 deletions

View File

@@ -641,6 +641,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;