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 #ifndef MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 5 #ifndef MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
6 #define MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 6 #define MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void SetMute(JNIEnv* env, jobject obj, jboolean muted); | 60 void SetMute(JNIEnv* env, jobject obj, jboolean muted); |
61 | 61 |
62 protected: | 62 protected: |
63 virtual ~AudioManagerAndroid(); | 63 virtual ~AudioManagerAndroid(); |
64 | 64 |
65 virtual AudioParameters GetPreferredOutputStreamParameters( | 65 virtual AudioParameters GetPreferredOutputStreamParameters( |
66 const std::string& output_device_id, | 66 const std::string& output_device_id, |
67 const AudioParameters& input_params) OVERRIDE; | 67 const AudioParameters& input_params) OVERRIDE; |
68 | 68 |
69 private: | 69 private: |
70 bool HadNoAudioStreams(); | |
71 void Init(); | 70 void Init(); |
72 void Close(); | 71 void Close(); |
73 void SetCommunicationAudioModeOn(bool on); | 72 void SetAudioMode(int mode); |
74 bool SetAudioDevice(const std::string& device_id); | 73 void SetAudioDevice(const std::string& device_id); |
75 int GetNativeOutputSampleRate(); | 74 int GetNativeOutputSampleRate(); |
76 bool IsAudioLowLatencySupported(); | 75 bool IsAudioLowLatencySupported(); |
77 int GetAudioLowLatencyOutputFrameSize(); | 76 int GetAudioLowLatencyOutputFrameSize(); |
78 int GetOptimalOutputFrameSize(int sample_rate, int channels); | 77 int GetOptimalOutputFrameSize(int sample_rate, int channels); |
79 | 78 |
80 void DoSetMuteOnAudioThread(bool muted); | 79 void DoSetMuteOnAudioThread(bool muted); |
81 | 80 |
82 // Allow the AudioAndroidTest to access private methods. | 81 // Allow the AudioAndroidTest to access private methods. |
83 FRIEND_TEST_ALL_PREFIXES(AudioAndroidOutputTest, IsAudioLowLatencySupported); | 82 FRIEND_TEST_ALL_PREFIXES(AudioAndroidOutputTest, IsAudioLowLatencySupported); |
84 | 83 |
85 // Java AudioManager instance. | 84 // Java AudioManager instance. |
86 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; | 85 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; |
87 | 86 |
88 typedef std::set<OpenSLESOutputStream*> OutputStreams; | 87 typedef std::set<OpenSLESOutputStream*> OutputStreams; |
89 OutputStreams streams_; | 88 OutputStreams streams_; |
90 // TODO(wjia): remove this lock once unit test modules are fixed to call | 89 // TODO(wjia): remove this lock once unit test modules are fixed to call |
91 // AudioManager::MakeAudioOutputStream on the audio thread. For now, this | 90 // AudioManager::MakeAudioOutputStream on the audio thread. For now, this |
92 // lock is used to guard access to |streams_|. | 91 // lock is used to guard access to |streams_|. |
93 base::Lock streams_lock_; | 92 base::Lock streams_lock_; |
94 | 93 |
95 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); | 94 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); |
96 }; | 95 }; |
97 | 96 |
98 } // namespace media | 97 } // namespace media |
99 | 98 |
100 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 99 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
OLD | NEW |