| 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(); |
| 70 void Init(); | 71 void Init(); |
| 71 void Close(); | 72 void Close(); |
| 72 void SetAudioMode(int mode); | 73 void SetCommunicationAudioModeOn(bool on); |
| 73 void SetAudioDevice(const std::string& device_id); | 74 bool SetAudioDevice(const std::string& device_id); |
| 74 int GetNativeOutputSampleRate(); | 75 int GetNativeOutputSampleRate(); |
| 75 bool IsAudioLowLatencySupported(); | 76 bool IsAudioLowLatencySupported(); |
| 76 int GetAudioLowLatencyOutputFrameSize(); | 77 int GetAudioLowLatencyOutputFrameSize(); |
| 77 int GetOptimalOutputFrameSize(int sample_rate, int channels); | 78 int GetOptimalOutputFrameSize(int sample_rate, int channels); |
| 78 | 79 |
| 79 void DoSetMuteOnAudioThread(bool muted); | 80 void DoSetMuteOnAudioThread(bool muted); |
| 80 | 81 |
| 81 // Allow the AudioAndroidTest to access private methods. | 82 // Allow the AudioAndroidTest to access private methods. |
| 82 FRIEND_TEST_ALL_PREFIXES(AudioAndroidOutputTest, IsAudioLowLatencySupported); | 83 FRIEND_TEST_ALL_PREFIXES(AudioAndroidOutputTest, IsAudioLowLatencySupported); |
| 83 | 84 |
| 84 // Java AudioManager instance. | 85 // Java AudioManager instance. |
| 85 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; | 86 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; |
| 86 | 87 |
| 87 typedef std::set<OpenSLESOutputStream*> OutputStreams; | 88 typedef std::set<OpenSLESOutputStream*> OutputStreams; |
| 88 OutputStreams streams_; | 89 OutputStreams streams_; |
| 89 // TODO(wjia): remove this lock once unit test modules are fixed to call | 90 // TODO(wjia): remove this lock once unit test modules are fixed to call |
| 90 // AudioManager::MakeAudioOutputStream on the audio thread. For now, this | 91 // AudioManager::MakeAudioOutputStream on the audio thread. For now, this |
| 91 // lock is used to guard access to |streams_|. | 92 // lock is used to guard access to |streams_|. |
| 92 base::Lock streams_lock_; | 93 base::Lock streams_lock_; |
| 93 | 94 |
| 94 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); | 95 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 } // namespace media | 98 } // namespace media |
| 98 | 99 |
| 99 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 100 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
| OLD | NEW |