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/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
15 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
16 #include "jni/AudioManagerAndroid_jni.h" | 15 #include "jni/AudioManagerAndroid_jni.h" |
17 #include "media/audio/android/audio_record_input.h" | 16 #include "media/audio/android/audio_record_input.h" |
18 #include "media/audio/android/opensles_input.h" | 17 #include "media/audio/android/opensles_input.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return input_stream_count() == 0; | 347 return input_stream_count() == 0; |
349 } | 348 } |
350 | 349 |
351 jobject AudioManagerAndroid::GetJavaAudioManager() { | 350 jobject AudioManagerAndroid::GetJavaAudioManager() { |
352 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 351 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
353 if (j_audio_manager_.is_null()) { | 352 if (j_audio_manager_.is_null()) { |
354 // Create the Android audio manager on the audio thread. | 353 // Create the Android audio manager on the audio thread. |
355 DVLOG(2) << "Creating Java part of the audio manager"; | 354 DVLOG(2) << "Creating Java part of the audio manager"; |
356 j_audio_manager_.Reset(Java_AudioManagerAndroid_createAudioManagerAndroid( | 355 j_audio_manager_.Reset(Java_AudioManagerAndroid_createAudioManagerAndroid( |
357 base::android::AttachCurrentThread(), | 356 base::android::AttachCurrentThread(), |
358 base::android::GetApplicationContext(), | |
359 reinterpret_cast<intptr_t>(this))); | 357 reinterpret_cast<intptr_t>(this))); |
360 | 358 |
361 // Prepare the list of audio devices and register receivers for device | 359 // Prepare the list of audio devices and register receivers for device |
362 // notifications. | 360 // notifications. |
363 Java_AudioManagerAndroid_init(base::android::AttachCurrentThread(), | 361 Java_AudioManagerAndroid_init(base::android::AttachCurrentThread(), |
364 j_audio_manager_); | 362 j_audio_manager_); |
365 } | 363 } |
366 return j_audio_manager_.obj(); | 364 return j_audio_manager_.obj(); |
367 } | 365 } |
368 | 366 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 output_volume_override_ = volume; | 422 output_volume_override_ = volume; |
425 | 423 |
426 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 424 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
427 for (OutputStreams::iterator it = streams_.begin(); | 425 for (OutputStreams::iterator it = streams_.begin(); |
428 it != streams_.end(); ++it) { | 426 it != streams_.end(); ++it) { |
429 (*it)->SetVolume(volume); | 427 (*it)->SetVolume(volume); |
430 } | 428 } |
431 } | 429 } |
432 | 430 |
433 } // namespace media | 431 } // namespace media |
OLD | NEW |