From 49085ef280db84e47f41a06a247db56c70f6f037 Mon Sep 17 00:00:00 2001 From: henrika Date: Fri, 30 Jun 2017 06:25:25 -0700 Subject: [PATCH] Improves audio-routing in combination with BT in AppRTCMobile on Android. This CL improves (speeds up) audio routing for BT devices in AppRTCMobile. NOTRY=TRUE BUG=webrtc:7888 Review-Url: https://codereview.webrtc.org/2961403003 Cr-Commit-Position: refs/heads/master@{#18858} --- .../src/org/appspot/apprtc/AppRTCBluetoothManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/AppRTCBluetoothManager.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/AppRTCBluetoothManager.java index 9553c8a0f5..10b1a5cbef 100644 --- a/webrtc/examples/androidapp/src/org/appspot/apprtc/AppRTCBluetoothManager.java +++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/AppRTCBluetoothManager.java @@ -329,9 +329,11 @@ public class AppRTCBluetoothManager { // intent ACTION_SCO_AUDIO_STATE_UPDATED and wait for the state to be SCO_AUDIO_STATE_CONNECTED. bluetoothState = State.SCO_CONNECTING; audioManager.startBluetoothSco(); + audioManager.setBluetoothScoOn(true); scoConnectionAttempts++; startTimer(); - Log.d(TAG, "startScoAudio done: BT state=" + bluetoothState); + Log.d(TAG, "startScoAudio done: BT state=" + bluetoothState + ", " + + "SCO is on: " + isScoOn()); return true; } @@ -345,8 +347,10 @@ public class AppRTCBluetoothManager { } cancelTimer(); audioManager.stopBluetoothSco(); + audioManager.setBluetoothScoOn(false); bluetoothState = State.SCO_DISCONNECTING; - Log.d(TAG, "stopScoAudio done: BT state=" + bluetoothState); + Log.d(TAG, "stopScoAudio done: BT state=" + bluetoothState + ", " + + "SCO is on: " + isScoOn()); } /** @@ -370,7 +374,7 @@ public class AppRTCBluetoothManager { bluetoothState = State.HEADSET_UNAVAILABLE; Log.d(TAG, "No connected bluetooth headset"); } else { - // Always use first device is list. Android only supports one device. + // Always use first device in list. Android only supports one device. bluetoothDevice = devices.get(0); bluetoothState = State.HEADSET_AVAILABLE; Log.d(TAG, "Connected bluetooth headset: "