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

Side by Side Diff: webrtc/modules/audio_device/android/audio_manager.h

Issue 1344563002: Improving support for Android Audio Effects in WebRTC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improved comments Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Revert any setting done by Init(). 67 // Revert any setting done by Init().
68 bool Close(); 68 bool Close();
69 69
70 // Returns true if current audio mode is AudioManager.MODE_IN_COMMUNICATION. 70 // Returns true if current audio mode is AudioManager.MODE_IN_COMMUNICATION.
71 bool IsCommunicationModeEnabled() const; 71 bool IsCommunicationModeEnabled() const;
72 72
73 // Native audio parameters stored during construction. 73 // Native audio parameters stored during construction.
74 const AudioParameters& GetPlayoutAudioParameters(); 74 const AudioParameters& GetPlayoutAudioParameters();
75 const AudioParameters& GetRecordAudioParameters(); 75 const AudioParameters& GetRecordAudioParameters();
76 76
77 // Returns true if the device supports a built-in Acoustic Echo Canceler. 77 // Returns true if the device supports built-in audio effects for AEC, AGC
78 // Some devices can also be blacklisted for use in combination with an AEC 78 // and NS. Some devices can also be blacklisted for use in combination with
79 // and these devices will return false. 79 // platform effects and these devices will return false.
80 // Can currently only be used in combination with a Java based audio backend 80 // Can currently only be used in combination with a Java based audio backend
81 // for the recoring side (i.e. using the android.media.AudioRecord API). 81 // for the recoring side (i.e. using the android.media.AudioRecord API).
82 bool IsAcousticEchoCancelerSupported() const; 82 bool IsAcousticEchoCancelerSupported() const;
83 bool IsAutomaticGainControlSupported() const;
84 bool IsNoiseSuppressorSupported() const;
83 85
84 // Returns true if the device supports the low-latency audio paths in 86 // Returns true if the device supports the low-latency audio paths in
85 // combination with OpenSL ES. 87 // combination with OpenSL ES.
86 bool IsLowLatencyPlayoutSupported() const; 88 bool IsLowLatencyPlayoutSupported() const;
87 89
88 // Returns the estimated total delay of this device. Unit is in milliseconds. 90 // Returns the estimated total delay of this device. Unit is in milliseconds.
89 // The vaule is set once at construction and never changes after that. 91 // The vaule is set once at construction and never changes after that.
90 // Possible values are webrtc::kLowLatencyModeDelayEstimateInMilliseconds and 92 // Possible values are webrtc::kLowLatencyModeDelayEstimateInMilliseconds and
91 // webrtc::kHighLatencyModeDelayEstimateInMilliseconds. 93 // webrtc::kHighLatencyModeDelayEstimateInMilliseconds.
92 int GetDelayEstimateInMilliseconds() const; 94 int GetDelayEstimateInMilliseconds() const;
93 95
94 private: 96 private:
95 // Called from Java side so we can cache the native audio parameters. 97 // Called from Java side so we can cache the native audio parameters.
96 // This method will be called by the WebRtcAudioManager constructor, i.e. 98 // This method will be called by the WebRtcAudioManager constructor, i.e.
97 // on the same thread that this object is created on. 99 // on the same thread that this object is created on.
98 static void JNICALL CacheAudioParameters(JNIEnv* env, 100 static void JNICALL CacheAudioParameters(JNIEnv* env,
99 jobject obj, 101 jobject obj,
100 jint sample_rate, 102 jint sample_rate,
101 jint channels, 103 jint channels,
102 jboolean hardware_aec, 104 jboolean hardware_aec,
105 jboolean hardware_agc,
106 jboolean hardware_ns,
103 jboolean low_latency_output, 107 jboolean low_latency_output,
104 jint output_buffer_size, 108 jint output_buffer_size,
105 jint input_buffer_size, 109 jint input_buffer_size,
106 jlong native_audio_manager); 110 jlong native_audio_manager);
107 void OnCacheAudioParameters(JNIEnv* env, 111 void OnCacheAudioParameters(JNIEnv* env,
108 jint sample_rate, 112 jint sample_rate,
109 jint channels, 113 jint channels,
110 jboolean hardware_aec, 114 jboolean hardware_aec,
115 jboolean hardware_agc,
116 jboolean hardware_ns,
111 jboolean low_latency_output, 117 jboolean low_latency_output,
112 jint output_buffer_size, 118 jint output_buffer_size,
113 jint input_buffer_size); 119 jint input_buffer_size);
114 120
115 // Stores thread ID in the constructor. 121 // Stores thread ID in the constructor.
116 // We can then use ThreadChecker::CalledOnValidThread() to ensure that 122 // We can then use ThreadChecker::CalledOnValidThread() to ensure that
117 // other methods are called from the same thread. 123 // other methods are called from the same thread.
118 rtc::ThreadChecker thread_checker_; 124 rtc::ThreadChecker thread_checker_;
119 125
120 // Calls AttachCurrentThread() if this thread is not attached at construction. 126 // Calls AttachCurrentThread() if this thread is not attached at construction.
121 // Also ensures that DetachCurrentThread() is called at destruction. 127 // Also ensures that DetachCurrentThread() is called at destruction.
122 AttachCurrentThreadIfNeeded attach_thread_if_needed_; 128 AttachCurrentThreadIfNeeded attach_thread_if_needed_;
123 129
124 // Wraps the JNI interface pointer and methods associated with it. 130 // Wraps the JNI interface pointer and methods associated with it.
125 rtc::scoped_ptr<JNIEnvironment> j_environment_; 131 rtc::scoped_ptr<JNIEnvironment> j_environment_;
126 132
127 // Contains factory method for creating the Java object. 133 // Contains factory method for creating the Java object.
128 rtc::scoped_ptr<NativeRegistration> j_native_registration_; 134 rtc::scoped_ptr<NativeRegistration> j_native_registration_;
129 135
130 // Wraps the Java specific parts of the AudioManager. 136 // Wraps the Java specific parts of the AudioManager.
131 rtc::scoped_ptr<AudioManager::JavaAudioManager> j_audio_manager_; 137 rtc::scoped_ptr<AudioManager::JavaAudioManager> j_audio_manager_;
132 138
133 AudioDeviceModule::AudioLayer audio_layer_; 139 AudioDeviceModule::AudioLayer audio_layer_;
134 140
135 // Set to true by Init() and false by Close(). 141 // Set to true by Init() and false by Close().
136 bool initialized_; 142 bool initialized_;
137 143
138 // True if device supports hardware (or built-in) AEC. 144 // True if device supports hardware (or built-in) AEC.
139 bool hardware_aec_; 145 bool hardware_aec_;
146 // True if device supports hardware (or built-in) AGC.
147 bool hardware_agc_;
148 // True if device supports hardware (or built-in) NS.
149 bool hardware_ns_;
140 150
141 // True if device supports the low-latency OpenSL ES audio path. 151 // True if device supports the low-latency OpenSL ES audio path.
142 bool low_latency_playout_; 152 bool low_latency_playout_;
143 153
144 // The delay estimate can take one of two fixed values depending on if the 154 // The delay estimate can take one of two fixed values depending on if the
145 // device supports low-latency output or not. 155 // device supports low-latency output or not.
146 int delay_estimate_in_milliseconds_; 156 int delay_estimate_in_milliseconds_;
147 157
148 // Contains native parameters (e.g. sample rate, channel configuration). 158 // Contains native parameters (e.g. sample rate, channel configuration).
149 // Set at construction in OnCacheAudioParameters() which is called from 159 // Set at construction in OnCacheAudioParameters() which is called from
150 // Java on the same thread as this object is created on. 160 // Java on the same thread as this object is created on.
151 AudioParameters playout_parameters_; 161 AudioParameters playout_parameters_;
152 AudioParameters record_parameters_; 162 AudioParameters record_parameters_;
153 }; 163 };
154 164
155 } // namespace webrtc 165 } // namespace webrtc
156 166
157 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_ 167 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/audio_device_template.h ('k') | webrtc/modules/audio_device/android/audio_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698