| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/android/audio_manager_android.h" | 5 #include "media/audio/android/audio_manager_android.h" |
| 6 | 6 |
| 7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
| 8 #include "base/android/context_utils.h" | |
| 9 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 10 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 11 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/bind.h" | 11 #include "base/bind.h" |
| 13 #include "base/logging.h" | 12 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 15 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 16 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 17 #include "jni/AudioManagerAndroid_jni.h" | 16 #include "jni/AudioManagerAndroid_jni.h" |
| 18 #include "media/audio/android/audio_record_input.h" | 17 #include "media/audio/android/audio_record_input.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 return input_stream_count() == 0; | 346 return input_stream_count() == 0; |
| 348 } | 347 } |
| 349 | 348 |
| 350 jobject AudioManagerAndroid::GetJavaAudioManager() { | 349 jobject AudioManagerAndroid::GetJavaAudioManager() { |
| 351 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 350 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
| 352 if (j_audio_manager_.is_null()) { | 351 if (j_audio_manager_.is_null()) { |
| 353 // Create the Android audio manager on the audio thread. | 352 // Create the Android audio manager on the audio thread. |
| 354 DVLOG(2) << "Creating Java part of the audio manager"; | 353 DVLOG(2) << "Creating Java part of the audio manager"; |
| 355 j_audio_manager_.Reset(Java_AudioManagerAndroid_createAudioManagerAndroid( | 354 j_audio_manager_.Reset(Java_AudioManagerAndroid_createAudioManagerAndroid( |
| 356 base::android::AttachCurrentThread(), | 355 base::android::AttachCurrentThread(), |
| 357 base::android::GetApplicationContext(), | |
| 358 reinterpret_cast<intptr_t>(this))); | 356 reinterpret_cast<intptr_t>(this))); |
| 359 | 357 |
| 360 // Prepare the list of audio devices and register receivers for device | 358 // Prepare the list of audio devices and register receivers for device |
| 361 // notifications. | 359 // notifications. |
| 362 Java_AudioManagerAndroid_init(base::android::AttachCurrentThread(), | 360 Java_AudioManagerAndroid_init(base::android::AttachCurrentThread(), |
| 363 j_audio_manager_); | 361 j_audio_manager_); |
| 364 } | 362 } |
| 365 return j_audio_manager_.obj(); | 363 return j_audio_manager_.obj(); |
| 366 } | 364 } |
| 367 | 365 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 output_volume_override_ = volume; | 421 output_volume_override_ = volume; |
| 424 | 422 |
| 425 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 423 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
| 426 for (OutputStreams::iterator it = streams_.begin(); | 424 for (OutputStreams::iterator it = streams_.begin(); |
| 427 it != streams_.end(); ++it) { | 425 it != streams_.end(); ++it) { |
| 428 (*it)->SetVolume(volume); | 426 (*it)->SetVolume(volume); |
| 429 } | 427 } |
| 430 } | 428 } |
| 431 | 429 |
| 432 } // namespace media | 430 } // namespace media |
| OLD | NEW |