| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "media/audio/audio_manager_base.h" | 14 #include "media/audio/audio_manager_base.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 class OpenSLESOutputStream; | 18 class OpenSLESOutputStream; |
| 19 | 19 |
| 20 // Android implemention of AudioManager. | 20 // Android implemention of AudioManager. |
| 21 class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase { | 21 class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase { |
| 22 public: | 22 public: |
| 23 AudioManagerAndroid( | 23 AudioManagerAndroid( |
| 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| 26 AudioLogFactory* audio_log_factory); | 26 AudioLogFactory* audio_log_factory); |
| 27 | 27 |
| 28 void InitializeIfNeeded(); |
| 29 |
| 28 // Implementation of AudioManager. | 30 // Implementation of AudioManager. |
| 29 bool HasAudioOutputDevices() override; | 31 bool HasAudioOutputDevices() override; |
| 30 bool HasAudioInputDevices() override; | 32 bool HasAudioInputDevices() override; |
| 31 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; | 33 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
| 32 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; | 34 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
| 33 AudioParameters GetInputStreamParameters( | 35 AudioParameters GetInputStreamParameters( |
| 34 const std::string& device_id) override; | 36 const std::string& device_id) override; |
| 35 | 37 |
| 36 AudioOutputStream* MakeAudioOutputStream( | 38 AudioOutputStream* MakeAudioOutputStream( |
| 37 const AudioParameters& params, | 39 const AudioParameters& params, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 bool HasOutputVolumeOverride(double* out_volume) const; | 75 bool HasOutputVolumeOverride(double* out_volume) const; |
| 74 | 76 |
| 75 protected: | 77 protected: |
| 76 ~AudioManagerAndroid() override; | 78 ~AudioManagerAndroid() override; |
| 77 | 79 |
| 78 AudioParameters GetPreferredOutputStreamParameters( | 80 AudioParameters GetPreferredOutputStreamParameters( |
| 79 const std::string& output_device_id, | 81 const std::string& output_device_id, |
| 80 const AudioParameters& input_params) override; | 82 const AudioParameters& input_params) override; |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 void InitializeOnAudioThread(); | 85 jobject GetJavaAudioManager(); |
| 84 | |
| 85 bool HasNoAudioInputStreams(); | 86 bool HasNoAudioInputStreams(); |
| 86 void SetCommunicationAudioModeOn(bool on); | 87 void SetCommunicationAudioModeOn(bool on); |
| 87 bool SetAudioDevice(const std::string& device_id); | 88 bool SetAudioDevice(const std::string& device_id); |
| 88 int GetNativeOutputSampleRate(); | 89 int GetNativeOutputSampleRate(); |
| 89 bool IsAudioLowLatencySupported(); | 90 bool IsAudioLowLatencySupported(); |
| 90 int GetAudioLowLatencyOutputFrameSize(); | 91 int GetAudioLowLatencyOutputFrameSize(); |
| 91 int GetOptimalOutputFrameSize(int sample_rate, int channels); | 92 int GetOptimalOutputFrameSize(int sample_rate, int channels); |
| 92 | 93 |
| 93 void DoSetMuteOnAudioThread(bool muted); | 94 void DoSetMuteOnAudioThread(bool muted); |
| 94 void DoSetVolumeOnAudioThread(double volume); | 95 void DoSetVolumeOnAudioThread(double volume); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 106 // If set, overrides volume level on output streams | 107 // If set, overrides volume level on output streams |
| 107 bool output_volume_override_set_; | 108 bool output_volume_override_set_; |
| 108 double output_volume_override_; | 109 double output_volume_override_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); | 111 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 } // namespace media | 114 } // namespace media |
| 114 | 115 |
| 115 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 116 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
| OLD | NEW |