OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // 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 |
87 // combination with OpenSL ES. | 87 // combination with OpenSL ES. |
88 bool IsLowLatencyPlayoutSupported() const; | 88 bool IsLowLatencyPlayoutSupported() const; |
89 | 89 |
90 // 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. |
91 // 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. |
92 // Possible values are webrtc::kLowLatencyModeDelayEstimateInMilliseconds and | 92 // Possible values are webrtc::kLowLatencyModeDelayEstimateInMilliseconds and |
93 // webrtc::kHighLatencyModeDelayEstimateInMilliseconds. | 93 // webrtc::kHighLatencyModeDelayEstimateInMilliseconds. |
94 int GetDelayEstimateInMilliseconds() const; | 94 int GetDelayEstimateInMilliseconds() const; |
95 | 95 |
| 96 int OutputStreamType() const { return output_stream_type_; } |
| 97 |
96 private: | 98 private: |
97 // Called from Java side so we can cache the native audio parameters. | 99 // Called from Java side so we can cache the native audio parameters. |
98 // This method will be called by the WebRtcAudioManager constructor, i.e. | 100 // This method will be called by the WebRtcAudioManager constructor, i.e. |
99 // on the same thread that this object is created on. | 101 // on the same thread that this object is created on. |
100 static void JNICALL CacheAudioParameters(JNIEnv* env, | 102 static void JNICALL CacheAudioParameters(JNIEnv* env, |
101 jobject obj, | 103 jobject obj, |
102 jint sample_rate, | 104 jint sample_rate, |
103 jint channels, | 105 jint channels, |
104 jboolean hardware_aec, | 106 jboolean hardware_aec, |
105 jboolean hardware_agc, | 107 jboolean hardware_agc, |
106 jboolean hardware_ns, | 108 jboolean hardware_ns, |
107 jboolean low_latency_output, | 109 jboolean low_latency_output, |
108 jint output_buffer_size, | 110 jint output_buffer_size, |
109 jint input_buffer_size, | 111 jint input_buffer_size, |
| 112 jint output_stream_type, |
110 jlong native_audio_manager); | 113 jlong native_audio_manager); |
111 void OnCacheAudioParameters(JNIEnv* env, | 114 void OnCacheAudioParameters(JNIEnv* env, |
112 jint sample_rate, | 115 jint sample_rate, |
113 jint channels, | 116 jint channels, |
114 jboolean hardware_aec, | 117 jboolean hardware_aec, |
115 jboolean hardware_agc, | 118 jboolean hardware_agc, |
116 jboolean hardware_ns, | 119 jboolean hardware_ns, |
117 jboolean low_latency_output, | 120 jboolean low_latency_output, |
118 jint output_buffer_size, | 121 jint output_buffer_size, |
119 jint input_buffer_size); | 122 jint input_buffer_size, |
| 123 jint output_stream_type); |
120 | 124 |
121 // Stores thread ID in the constructor. | 125 // Stores thread ID in the constructor. |
122 // We can then use ThreadChecker::CalledOnValidThread() to ensure that | 126 // We can then use ThreadChecker::CalledOnValidThread() to ensure that |
123 // other methods are called from the same thread. | 127 // other methods are called from the same thread. |
124 rtc::ThreadChecker thread_checker_; | 128 rtc::ThreadChecker thread_checker_; |
125 | 129 |
126 // Calls AttachCurrentThread() if this thread is not attached at construction. | 130 // Calls AttachCurrentThread() if this thread is not attached at construction. |
127 // Also ensures that DetachCurrentThread() is called at destruction. | 131 // Also ensures that DetachCurrentThread() is called at destruction. |
128 AttachCurrentThreadIfNeeded attach_thread_if_needed_; | 132 AttachCurrentThreadIfNeeded attach_thread_if_needed_; |
129 | 133 |
(...skipping 18 matching lines...) Expand all Loading... |
148 // True if device supports hardware (or built-in) NS. | 152 // True if device supports hardware (or built-in) NS. |
149 bool hardware_ns_; | 153 bool hardware_ns_; |
150 | 154 |
151 // True if device supports the low-latency OpenSL ES audio path. | 155 // True if device supports the low-latency OpenSL ES audio path. |
152 bool low_latency_playout_; | 156 bool low_latency_playout_; |
153 | 157 |
154 // The delay estimate can take one of two fixed values depending on if the | 158 // The delay estimate can take one of two fixed values depending on if the |
155 // device supports low-latency output or not. | 159 // device supports low-latency output or not. |
156 int delay_estimate_in_milliseconds_; | 160 int delay_estimate_in_milliseconds_; |
157 | 161 |
| 162 // Contains the output stream type provided to this class at construction by |
| 163 // the AudioManager in Java land. Possible values are: |
| 164 // - AudioManager.STREAM_VOICE_CALL = 0 |
| 165 // - AudioManager.STREAM_RING = 2 |
| 166 // - AudioManager.STREAM_MUSIC = 3 |
| 167 int output_stream_type_; |
| 168 |
158 // Contains native parameters (e.g. sample rate, channel configuration). | 169 // Contains native parameters (e.g. sample rate, channel configuration). |
159 // Set at construction in OnCacheAudioParameters() which is called from | 170 // Set at construction in OnCacheAudioParameters() which is called from |
160 // Java on the same thread as this object is created on. | 171 // Java on the same thread as this object is created on. |
161 AudioParameters playout_parameters_; | 172 AudioParameters playout_parameters_; |
162 AudioParameters record_parameters_; | 173 AudioParameters record_parameters_; |
163 }; | 174 }; |
164 | 175 |
165 } // namespace webrtc | 176 } // namespace webrtc |
166 | 177 |
167 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_ | 178 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_ |
OLD | NEW |