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/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "media/base/channel_layout.h" | 22 #include "media/base/channel_layout.h" |
23 | 23 |
24 using base::android::AppendJavaStringArrayToStringVector; | 24 using base::android::AppendJavaStringArrayToStringVector; |
25 using base::android::AttachCurrentThread; | 25 using base::android::AttachCurrentThread; |
26 using base::android::ConvertJavaStringToUTF8; | 26 using base::android::ConvertJavaStringToUTF8; |
27 using base::android::ConvertUTF8ToJavaString; | 27 using base::android::ConvertUTF8ToJavaString; |
28 using base::android::ScopedJavaLocalRef; | 28 using base::android::ScopedJavaLocalRef; |
29 | 29 |
30 namespace media { | 30 namespace media { |
31 | 31 |
32 static void AddDefaultDevice(AudioDeviceNames* device_names) { | |
33 DCHECK(device_names->empty()); | |
34 device_names->push_front( | |
35 AudioDeviceName(AudioManagerBase::kDefaultDeviceName, | |
36 AudioManagerBase::kDefaultDeviceId)); | |
37 } | |
38 | |
39 // Maximum number of output streams that can be open simultaneously. | 32 // Maximum number of output streams that can be open simultaneously. |
40 static const int kMaxOutputStreams = 10; | 33 static const int kMaxOutputStreams = 10; |
41 | 34 |
42 static const int kDefaultInputBufferSize = 1024; | 35 static const int kDefaultInputBufferSize = 1024; |
43 static const int kDefaultOutputBufferSize = 2048; | 36 static const int kDefaultOutputBufferSize = 2048; |
44 | 37 |
| 38 void AudioManagerAndroid::AddDefaultDevice( |
| 39 AudioDeviceNames* device_names) const { |
| 40 DCHECK(device_names->empty()); |
| 41 device_names->push_front(AudioDeviceName(GetDefaultDeviceName(), |
| 42 AudioManagerBase::kDefaultDeviceId)); |
| 43 } |
| 44 |
45 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 45 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
46 return new AudioManagerAndroid(audio_log_factory); | 46 return new AudioManagerAndroid(audio_log_factory); |
47 } | 47 } |
48 | 48 |
49 AudioManagerAndroid::AudioManagerAndroid(AudioLogFactory* audio_log_factory) | 49 AudioManagerAndroid::AudioManagerAndroid(AudioLogFactory* audio_log_factory) |
50 : AudioManagerBase(audio_log_factory), | 50 : AudioManagerBase(audio_log_factory), |
51 communication_mode_is_on_(false), | 51 communication_mode_is_on_(false), |
52 output_volume_override_set_(false), | 52 output_volume_override_set_(false), |
53 output_volume_override_(0) { | 53 output_volume_override_(0) { |
54 SetMaxOutputStreamsAllowed(kMaxOutputStreams); | 54 SetMaxOutputStreamsAllowed(kMaxOutputStreams); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 output_volume_override_ = volume; | 404 output_volume_override_ = volume; |
405 | 405 |
406 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 406 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
407 for (OutputStreams::iterator it = streams_.begin(); | 407 for (OutputStreams::iterator it = streams_.begin(); |
408 it != streams_.end(); ++it) { | 408 it != streams_.end(); ++it) { |
409 (*it)->SetVolume(volume); | 409 (*it)->SetVolume(volume); |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 } // namespace media | 413 } // namespace media |
OLD | NEW |