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

Unified Diff: webrtc/modules/audio_device/android/audio_device_template.h

Issue 1165923002: Removes automatic setting of COMM mode in WebRTC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
Index: webrtc/modules/audio_device/android/audio_device_template.h
diff --git a/webrtc/modules/audio_device/android/audio_device_template.h b/webrtc/modules/audio_device/android/audio_device_template.h
index 69ede541c41cdce55cfdebb161e6e9d51d8bb57d..649f14fadcb4f93786c399ae594c372927204f1e 100644
--- a/webrtc/modules/audio_device/android/audio_device_template.h
+++ b/webrtc/modules/audio_device/android/audio_device_template.h
@@ -125,12 +125,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
}
int32_t InitPlayout() override {
- // Switches the Android audio mode to MODE_IN_COMMUNICATION to ensure that
- // audio routing, volume control and echo performance are the best possible
- // for VoIP. InitRecording() does the same type of call but only the first
- // call has any effect.
- // This call does nothing if MODE_IN_COMMUNICATION was already set.
- audio_manager_->SetCommunicationMode(true);
return output_.InitPlayout();
}
@@ -144,12 +138,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
}
int32_t InitRecording() override {
- // Switches the Android audio mode to MODE_IN_COMMUNICATION to ensure that
- // audio routing, volume control and echo performance are the best possible
- // for VoIP. InitRecording() does the same type of call but only the first
- // call has any effect.
- // This call does nothing if MODE_IN_COMMUNICATION was already set.
- audio_manager_->SetCommunicationMode(true);
return input_.InitRecording();
}
@@ -158,6 +146,7 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
}
int32_t StartPlayout() override {
+ DCHECK(audio_manager_->IsCommunicationModeEnabled());
return output_.StartPlayout();
}
@@ -166,11 +155,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
if (!Playing())
return 0;
int32_t err = output_.StopPlayout();
- if (!Recording()) {
- // Restore initial audio mode since all audio streaming is disabled.
- // The default mode was stored in Init().
- audio_manager_->SetCommunicationMode(false);
- }
return err;
}
@@ -179,6 +163,7 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
}
int32_t StartRecording() override {
+ DCHECK(audio_manager_->IsCommunicationModeEnabled());
return input_.StartRecording();
}
@@ -187,11 +172,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
if (!Recording())
return 0;
int32_t err = input_.StopRecording();
- if (!Playing()) {
- // Restore initial audio mode since all audio streaming is disabled.
- // The default mode was is stored in Init().
- audio_manager_->SetCommunicationMode(false);
- }
return err;
}

Powered by Google App Engine
This is Rietveld 408576698