| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 initialized_(false), | 71 initialized_(false), |
| 72 hardware_aec_(false), | 72 hardware_aec_(false), |
| 73 hardware_agc_(false), | 73 hardware_agc_(false), |
| 74 hardware_ns_(false), | 74 hardware_ns_(false), |
| 75 low_latency_playout_(false), | 75 low_latency_playout_(false), |
| 76 low_latency_record_(false), | 76 low_latency_record_(false), |
| 77 delay_estimate_in_milliseconds_(0) { | 77 delay_estimate_in_milliseconds_(0) { |
| 78 ALOGD("ctor%s", GetThreadInfo().c_str()); | 78 ALOGD("ctor%s", GetThreadInfo().c_str()); |
| 79 RTC_CHECK(j_environment_); | 79 RTC_CHECK(j_environment_); |
| 80 JNINativeMethod native_methods[] = { | 80 JNINativeMethod native_methods[] = { |
| 81 {"nativeCacheAudioParameters", "(IIZZZZZZIIJ)V", | 81 {"nativeCacheAudioParameters", "(IIIZZZZZZIIJ)V", |
| 82 reinterpret_cast<void*>(&webrtc::AudioManager::CacheAudioParameters)}}; | 82 reinterpret_cast<void*>(&webrtc::AudioManager::CacheAudioParameters)}}; |
| 83 j_native_registration_ = j_environment_->RegisterNatives( | 83 j_native_registration_ = j_environment_->RegisterNatives( |
| 84 "org/webrtc/voiceengine/WebRtcAudioManager", native_methods, | 84 "org/webrtc/voiceengine/WebRtcAudioManager", native_methods, |
| 85 arraysize(native_methods)); | 85 arraysize(native_methods)); |
| 86 j_audio_manager_.reset(new JavaAudioManager( | 86 j_audio_manager_.reset(new JavaAudioManager( |
| 87 j_native_registration_.get(), | 87 j_native_registration_.get(), |
| 88 j_native_registration_->NewObject( | 88 j_native_registration_->NewObject( |
| 89 "<init>", "(Landroid/content/Context;J)V", | 89 "<init>", "(Landroid/content/Context;J)V", |
| 90 JVM::GetInstance()->context(), PointerTojlong(this)))); | 90 JVM::GetInstance()->context(), PointerTojlong(this)))); |
| 91 } | 91 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return pro_audio_; | 221 return pro_audio_; |
| 222 } | 222 } |
| 223 | 223 |
| 224 int AudioManager::GetDelayEstimateInMilliseconds() const { | 224 int AudioManager::GetDelayEstimateInMilliseconds() const { |
| 225 return delay_estimate_in_milliseconds_; | 225 return delay_estimate_in_milliseconds_; |
| 226 } | 226 } |
| 227 | 227 |
| 228 void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env, | 228 void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env, |
| 229 jobject obj, | 229 jobject obj, |
| 230 jint sample_rate, | 230 jint sample_rate, |
| 231 jint channels, | 231 jint output_channels, |
| 232 jint input_channels, |
| 232 jboolean hardware_aec, | 233 jboolean hardware_aec, |
| 233 jboolean hardware_agc, | 234 jboolean hardware_agc, |
| 234 jboolean hardware_ns, | 235 jboolean hardware_ns, |
| 235 jboolean low_latency_output, | 236 jboolean low_latency_output, |
| 236 jboolean low_latency_input, | 237 jboolean low_latency_input, |
| 237 jboolean pro_audio, | 238 jboolean pro_audio, |
| 238 jint output_buffer_size, | 239 jint output_buffer_size, |
| 239 jint input_buffer_size, | 240 jint input_buffer_size, |
| 240 jlong native_audio_manager) { | 241 jlong native_audio_manager) { |
| 241 webrtc::AudioManager* this_object = | 242 webrtc::AudioManager* this_object = |
| 242 reinterpret_cast<webrtc::AudioManager*>(native_audio_manager); | 243 reinterpret_cast<webrtc::AudioManager*>(native_audio_manager); |
| 243 this_object->OnCacheAudioParameters( | 244 this_object->OnCacheAudioParameters( |
| 244 env, sample_rate, channels, hardware_aec, hardware_agc, hardware_ns, | 245 env, sample_rate, output_channels, input_channels, hardware_aec, |
| 245 low_latency_output, low_latency_input, pro_audio, output_buffer_size, | 246 hardware_agc, hardware_ns, low_latency_output, low_latency_input, |
| 246 input_buffer_size); | 247 pro_audio, output_buffer_size, input_buffer_size); |
| 247 } | 248 } |
| 248 | 249 |
| 249 void AudioManager::OnCacheAudioParameters(JNIEnv* env, | 250 void AudioManager::OnCacheAudioParameters(JNIEnv* env, |
| 250 jint sample_rate, | 251 jint sample_rate, |
| 251 jint channels, | 252 jint output_channels, |
| 253 jint input_channels, |
| 252 jboolean hardware_aec, | 254 jboolean hardware_aec, |
| 253 jboolean hardware_agc, | 255 jboolean hardware_agc, |
| 254 jboolean hardware_ns, | 256 jboolean hardware_ns, |
| 255 jboolean low_latency_output, | 257 jboolean low_latency_output, |
| 256 jboolean low_latency_input, | 258 jboolean low_latency_input, |
| 257 jboolean pro_audio, | 259 jboolean pro_audio, |
| 258 jint output_buffer_size, | 260 jint output_buffer_size, |
| 259 jint input_buffer_size) { | 261 jint input_buffer_size) { |
| 260 ALOGD("OnCacheAudioParameters%s", GetThreadInfo().c_str()); | 262 ALOGD("OnCacheAudioParameters%s", GetThreadInfo().c_str()); |
| 261 ALOGD("hardware_aec: %d", hardware_aec); | 263 ALOGD("hardware_aec: %d", hardware_aec); |
| 262 ALOGD("hardware_agc: %d", hardware_agc); | 264 ALOGD("hardware_agc: %d", hardware_agc); |
| 263 ALOGD("hardware_ns: %d", hardware_ns); | 265 ALOGD("hardware_ns: %d", hardware_ns); |
| 264 ALOGD("low_latency_output: %d", low_latency_output); | 266 ALOGD("low_latency_output: %d", low_latency_output); |
| 265 ALOGD("low_latency_input: %d", low_latency_input); | 267 ALOGD("low_latency_input: %d", low_latency_input); |
| 266 ALOGD("pro_audio: %d", pro_audio); | 268 ALOGD("pro_audio: %d", pro_audio); |
| 267 ALOGD("sample_rate: %d", sample_rate); | 269 ALOGD("sample_rate: %d", sample_rate); |
| 268 ALOGD("channels: %d", channels); | 270 ALOGD("output_channels: %d", output_channels); |
| 271 ALOGD("input_channels: %d", input_channels); |
| 269 ALOGD("output_buffer_size: %d", output_buffer_size); | 272 ALOGD("output_buffer_size: %d", output_buffer_size); |
| 270 ALOGD("input_buffer_size: %d", input_buffer_size); | 273 ALOGD("input_buffer_size: %d", input_buffer_size); |
| 271 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 274 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 272 hardware_aec_ = hardware_aec; | 275 hardware_aec_ = hardware_aec; |
| 273 hardware_agc_ = hardware_agc; | 276 hardware_agc_ = hardware_agc; |
| 274 hardware_ns_ = hardware_ns; | 277 hardware_ns_ = hardware_ns; |
| 275 low_latency_playout_ = low_latency_output; | 278 low_latency_playout_ = low_latency_output; |
| 276 low_latency_record_ = low_latency_input; | 279 low_latency_record_ = low_latency_input; |
| 277 pro_audio_ = pro_audio; | 280 pro_audio_ = pro_audio; |
| 278 // TODO(henrika): add support for stereo output. | 281 playout_parameters_.reset(sample_rate, static_cast<size_t>(output_channels), |
| 279 playout_parameters_.reset(sample_rate, static_cast<size_t>(channels), | |
| 280 static_cast<size_t>(output_buffer_size)); | 282 static_cast<size_t>(output_buffer_size)); |
| 281 record_parameters_.reset(sample_rate, static_cast<size_t>(channels), | 283 record_parameters_.reset(sample_rate, static_cast<size_t>(input_channels), |
| 282 static_cast<size_t>(input_buffer_size)); | 284 static_cast<size_t>(input_buffer_size)); |
| 283 } | 285 } |
| 284 | 286 |
| 285 const AudioParameters& AudioManager::GetPlayoutAudioParameters() { | 287 const AudioParameters& AudioManager::GetPlayoutAudioParameters() { |
| 286 RTC_CHECK(playout_parameters_.is_valid()); | 288 RTC_CHECK(playout_parameters_.is_valid()); |
| 287 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 289 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 288 return playout_parameters_; | 290 return playout_parameters_; |
| 289 } | 291 } |
| 290 | 292 |
| 291 const AudioParameters& AudioManager::GetRecordAudioParameters() { | 293 const AudioParameters& AudioManager::GetRecordAudioParameters() { |
| 292 RTC_CHECK(record_parameters_.is_valid()); | 294 RTC_CHECK(record_parameters_.is_valid()); |
| 293 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 295 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 294 return record_parameters_; | 296 return record_parameters_; |
| 295 } | 297 } |
| 296 | 298 |
| 297 } // namespace webrtc | 299 } // namespace webrtc |
| OLD | NEW |