Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java

Issue 1165923002: Removes automatic setting of COMM mode in WebRTC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed CHECK Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_device/android/audio_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java
diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java
index a1b0bb4d336a7ffcf4f7cb339af0f5be779785bf..95c2ca0e4325a2ca7c5adeb822f5efe0709be424 100644
--- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java
+++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java
@@ -62,10 +62,8 @@ class WebRtcAudioManager {
private final AudioManager audioManager;
private boolean initialized = false;
- private boolean audioModeNeedsRestore = false;
private int nativeSampleRate;
private int nativeChannels;
- private int savedAudioMode = AudioManager.MODE_INVALID;
private boolean hardwareAEC;
private boolean lowLatencyOutput;
@@ -94,16 +92,7 @@ class WebRtcAudioManager {
if (initialized) {
return true;
}
-
- // Store current audio state so we can restore it when close() or
- // setCommunicationMode(false) is called.
- savedAudioMode = audioManager.getMode();
-
- if (DEBUG) {
- Logd("savedAudioMode: " + savedAudioMode);
- Logd("hasEarpiece: " + hasEarpiece());
- }
-
+ Logd("audio mode is: " + AUDIO_MODES[audioManager.getMode()]);
initialized = true;
return true;
}
@@ -113,31 +102,10 @@ class WebRtcAudioManager {
if (!initialized) {
return;
}
- // Restore previously stored audio states.
- if (audioModeNeedsRestore) {
- audioManager.setMode(savedAudioMode);
- }
}
- private void setCommunicationMode(boolean enable) {
- Logd("setCommunicationMode(" + enable + ")"
- + WebRtcAudioUtils.getThreadInfo());
- assertTrue(initialized);
- if (enable) {
- // Avoid switching mode if MODE_IN_COMMUNICATION is already in use.
- if (audioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION) {
- return;
- }
- // Switch to COMMUNICATION mode for best possible VoIP performance.
- audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
- audioModeNeedsRestore = true;
- Logd("changing audio mode to: " + AUDIO_MODES[audioManager.getMode()]);
- } else if (audioModeNeedsRestore) {
- // Restore audio mode that was stored in init().
- audioManager.setMode(savedAudioMode);
- audioModeNeedsRestore = false;
- Logd("restoring audio mode to: " + AUDIO_MODES[audioManager.getMode()]);
- }
+ private boolean isCommunicationModeEnabled() {
+ return (audioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION);
}
private void storeAudioParameters() {
« no previous file with comments | « webrtc/modules/audio_device/android/audio_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698