Chromium Code Reviews| 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 IsFirstCreatedAudioStream(); | |
|
tommi (sloooow) - chröme
2013/12/10 21:19:11
HasOneAudioStream?
(IsFirstXxx sounds like it woul
henrika (OOO until Aug 14)
2013/12/11 13:16:38
Removed.
| |
| 71 bool IsLastDestroyedAudioStream(); | |
|
tommi (sloooow) - chröme
2013/12/10 21:19:11
It's not clear how this is different from the func
henrika (OOO until Aug 14)
2013/12/11 13:16:38
Renamed.
Regarding input & output. The old soluti
tommi (sloooow) - chröme
2013/12/11 17:25:05
sgtm
| |
| 70 void Init(); | 72 void Init(); |
| 71 void Close(); | 73 void Close(); |
| 72 void SetAudioMode(int mode); | 74 void SetCommunicationAudioModeOn(bool on); |
| 73 void SetAudioDevice(const std::string& device_id); | 75 bool SetAudioDevice(const std::string& device_id); |
| 74 int GetNativeOutputSampleRate(); | 76 int GetNativeOutputSampleRate(); |
| 75 bool IsAudioLowLatencySupported(); | 77 bool IsAudioLowLatencySupported(); |
| 76 int GetAudioLowLatencyOutputFrameSize(); | 78 int GetAudioLowLatencyOutputFrameSize(); |
| 77 int GetOptimalOutputFrameSize(int sample_rate, int channels); | 79 int GetOptimalOutputFrameSize(int sample_rate, int channels); |
| 78 | 80 |
| 79 void DoSetMuteOnAudioThread(bool muted); | 81 void DoSetMuteOnAudioThread(bool muted); |
| 80 | 82 |
| 81 // Allow the AudioAndroidTest to access private methods. | 83 // Allow the AudioAndroidTest to access private methods. |
| 82 FRIEND_TEST_ALL_PREFIXES(AudioAndroidTest, IsAudioLowLatencySupported); | 84 FRIEND_TEST_ALL_PREFIXES(AudioAndroidTest, IsAudioLowLatencySupported); |
| 83 | 85 |
| 84 // Java AudioManager instance. | 86 // Java AudioManager instance. |
| 85 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; | 87 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; |
| 86 | 88 |
| 87 typedef std::set<OpenSLESOutputStream*> OutputStreams; | 89 typedef std::set<OpenSLESOutputStream*> OutputStreams; |
| 88 OutputStreams streams_; | 90 OutputStreams streams_; |
| 89 // TODO(wjia): remove this lock once unit test modules are fixed to call | 91 // TODO(wjia): remove this lock once unit test modules are fixed to call |
| 90 // AudioManager::MakeAudioOutputStream on the audio thread. For now, this | 92 // AudioManager::MakeAudioOutputStream on the audio thread. For now, this |
| 91 // lock is used to guard access to |streams_|. | 93 // lock is used to guard access to |streams_|. |
| 92 base::Lock streams_lock_; | 94 base::Lock streams_lock_; |
| 93 | 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); | 96 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace media | 99 } // namespace media |
| 98 | 100 |
| 99 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 101 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
| OLD | NEW |