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 MuteableAudioOutputStream; |
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(); | 28 void InitializeIfNeeded(); |
(...skipping 18 matching lines...) Expand all Loading... |
47 void ReleaseInputStream(AudioInputStream* stream) override; | 47 void ReleaseInputStream(AudioInputStream* stream) override; |
48 | 48 |
49 // Implementation of AudioManagerBase. | 49 // Implementation of AudioManagerBase. |
50 AudioOutputStream* MakeLinearOutputStream( | 50 AudioOutputStream* MakeLinearOutputStream( |
51 const AudioParameters& params, | 51 const AudioParameters& params, |
52 const LogCallback& log_callback) override; | 52 const LogCallback& log_callback) override; |
53 AudioOutputStream* MakeLowLatencyOutputStream( | 53 AudioOutputStream* MakeLowLatencyOutputStream( |
54 const AudioParameters& params, | 54 const AudioParameters& params, |
55 const std::string& device_id, | 55 const std::string& device_id, |
56 const LogCallback& log_callback) override; | 56 const LogCallback& log_callback) override; |
| 57 AudioOutputStream* MakeRawOutputStream( |
| 58 const AudioParameters& params, |
| 59 const std::string& device_id, |
| 60 const LogCallback& log_callback) override; |
57 AudioInputStream* MakeLinearInputStream( | 61 AudioInputStream* MakeLinearInputStream( |
58 const AudioParameters& params, | 62 const AudioParameters& params, |
59 const std::string& device_id, | 63 const std::string& device_id, |
60 const LogCallback& log_callback) override; | 64 const LogCallback& log_callback) override; |
61 AudioInputStream* MakeLowLatencyInputStream( | 65 AudioInputStream* MakeLowLatencyInputStream( |
62 const AudioParameters& params, | 66 const AudioParameters& params, |
63 const std::string& device_id, | 67 const std::string& device_id, |
64 const LogCallback& log_callback) override; | 68 const LogCallback& log_callback) override; |
65 | 69 |
66 static bool RegisterAudioManager(JNIEnv* env); | 70 static bool RegisterAudioManager(JNIEnv* env); |
(...skipping 23 matching lines...) Expand all Loading... |
90 bool IsAudioLowLatencySupported(); | 94 bool IsAudioLowLatencySupported(); |
91 int GetAudioLowLatencyOutputFrameSize(); | 95 int GetAudioLowLatencyOutputFrameSize(); |
92 int GetOptimalOutputFrameSize(int sample_rate, int channels); | 96 int GetOptimalOutputFrameSize(int sample_rate, int channels); |
93 | 97 |
94 void DoSetMuteOnAudioThread(bool muted); | 98 void DoSetMuteOnAudioThread(bool muted); |
95 void DoSetVolumeOnAudioThread(double volume); | 99 void DoSetVolumeOnAudioThread(double volume); |
96 | 100 |
97 // Java AudioManager instance. | 101 // Java AudioManager instance. |
98 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; | 102 base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_; |
99 | 103 |
100 typedef std::set<OpenSLESOutputStream*> OutputStreams; | 104 typedef std::set<MuteableAudioOutputStream*> OutputStreams; |
101 OutputStreams streams_; | 105 OutputStreams streams_; |
102 | 106 |
103 // Enabled when first input stream is created and set to false when last | 107 // Enabled when first input stream is created and set to false when last |
104 // input stream is destroyed. Also affects the stream type of output streams. | 108 // input stream is destroyed. Also affects the stream type of output streams. |
105 bool communication_mode_is_on_; | 109 bool communication_mode_is_on_; |
106 | 110 |
107 // If set, overrides volume level on output streams | 111 // If set, overrides volume level on output streams |
108 bool output_volume_override_set_; | 112 bool output_volume_override_set_; |
109 double output_volume_override_; | 113 double output_volume_override_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); | 115 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace media | 118 } // namespace media |
115 | 119 |
116 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 120 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
OLD | NEW |