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

Unified Diff: webrtc/modules/audio_device/android/audio_manager.cc

Issue 2411263003: Android audio playout now supports non-call media streams (Closed)
Patch Set: Adding support for SetCommunicationMode in AudioManager Created 4 years, 2 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_manager.cc
diff --git a/webrtc/modules/audio_device/android/audio_manager.cc b/webrtc/modules/audio_device/android/audio_manager.cc
index d8b7640c9b82392823e9e95817df8db6ba008c25..5c88d9e5d4bd9feef6ab7eb229fa973fbe8737d8 100644
--- a/webrtc/modules/audio_device/android/audio_manager.cc
+++ b/webrtc/modules/audio_device/android/audio_manager.cc
@@ -35,6 +35,8 @@ AudioManager::JavaAudioManager::JavaAudioManager(
: audio_manager_(std::move(audio_manager)),
init_(native_reg->GetMethodId("init", "()Z")),
dispose_(native_reg->GetMethodId("dispose", "()V")),
+ set_communication_mode_(
+ native_reg->GetMethodId("setCommunicationMode", "(Z)V")),
is_communication_mode_enabled_(
native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")),
is_device_blacklisted_for_open_sles_usage_(
@@ -55,6 +57,11 @@ void AudioManager::JavaAudioManager::Close() {
audio_manager_->CallVoidMethod(dispose_);
}
+void AudioManager::JavaAudioManager::SetCommunicationMode(bool enable) {
+ audio_manager_->CallVoidMethod(set_communication_mode_,
+ static_cast<jboolean>(enable));
+}
+
bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() {
return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_);
}
@@ -176,6 +183,12 @@ bool AudioManager::Close() {
return true;
}
+void AudioManager::SetCommunicationMode(bool enable) {
+ ALOGD("SetCommunicationMode(%d)", enable);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ j_audio_manager_->SetCommunicationMode(enable);
+}
+
bool AudioManager::IsCommunicationModeEnabled() const {
ALOGD("IsCommunicationModeEnabled()");
RTC_DCHECK(thread_checker_.CalledOnValidThread());
« no previous file with comments | « webrtc/modules/audio_device/android/audio_manager.h ('k') | webrtc/modules/audio_device/android/audio_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698