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}
This commit is contained in:
@ -329,9 +329,11 @@ public class AppRTCBluetoothManager {
|
|||||||
// intent ACTION_SCO_AUDIO_STATE_UPDATED and wait for the state to be SCO_AUDIO_STATE_CONNECTED.
|
// intent ACTION_SCO_AUDIO_STATE_UPDATED and wait for the state to be SCO_AUDIO_STATE_CONNECTED.
|
||||||
bluetoothState = State.SCO_CONNECTING;
|
bluetoothState = State.SCO_CONNECTING;
|
||||||
audioManager.startBluetoothSco();
|
audioManager.startBluetoothSco();
|
||||||
|
audioManager.setBluetoothScoOn(true);
|
||||||
scoConnectionAttempts++;
|
scoConnectionAttempts++;
|
||||||
startTimer();
|
startTimer();
|
||||||
Log.d(TAG, "startScoAudio done: BT state=" + bluetoothState);
|
Log.d(TAG, "startScoAudio done: BT state=" + bluetoothState + ", "
|
||||||
|
+ "SCO is on: " + isScoOn());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,8 +347,10 @@ public class AppRTCBluetoothManager {
|
|||||||
}
|
}
|
||||||
cancelTimer();
|
cancelTimer();
|
||||||
audioManager.stopBluetoothSco();
|
audioManager.stopBluetoothSco();
|
||||||
|
audioManager.setBluetoothScoOn(false);
|
||||||
bluetoothState = State.SCO_DISCONNECTING;
|
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;
|
bluetoothState = State.HEADSET_UNAVAILABLE;
|
||||||
Log.d(TAG, "No connected bluetooth headset");
|
Log.d(TAG, "No connected bluetooth headset");
|
||||||
} else {
|
} 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);
|
bluetoothDevice = devices.get(0);
|
||||||
bluetoothState = State.HEADSET_AVAILABLE;
|
bluetoothState = State.HEADSET_AVAILABLE;
|
||||||
Log.d(TAG, "Connected bluetooth headset: "
|
Log.d(TAG, "Connected bluetooth headset: "
|
||||||
|
|||||||
Reference in New Issue
Block a user