bluetooth: poll GetBluezSinkHFPDevice
Poll the GetBluezSinkHFPDevice in StartPlayingAudioSubprocess to
make it more stable.
BUG=b:191722792
TEST=test_that bluetooth_AdapterAUHealth. \
au_hfp_wbs_dut_as_source_back2back_test
Change-Id: Iada1fba0300d0cc5e4422a707358bc459b9cdba8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/chameleon/+/3622994
Tested-by: John Lai <johnlai@google.com>
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
Commit-Queue: John Lai <johnlai@google.com>
Auto-Submit: John Lai <johnlai@google.com>
diff --git a/chameleond/utils/bluetooth_audio.py b/chameleond/utils/bluetooth_audio.py
index 64b025b..01f3a3b 100644
--- a/chameleond/utils/bluetooth_audio.py
+++ b/chameleond/utils/bluetooth_audio.py
@@ -409,17 +409,16 @@
'Trying to start audio playing process when it is still running.')
return False
- device_number = self.GetBluezSinkHFPDevice(audio_profile)
+ device_number = self._PollForCondition(
+ lambda: self.GetBluezSinkHFPDevice(audio_profile),
+ desc='GetBluezSinkHFPDevice')
if device_number is None:
logging.error('Failed to get the device number of bluez_sink for HFP')
return False
-
self._profile = test_data
file_path = test_data['device_file']
-
-
sample_format = test_data['format'].lower().replace('_', '')
args = '--playback --device={d} --file-format=wav --format={s} --rate={r} '