| 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 // Low-latency audio capturing class utilizing audio input stream provided | 5 // Low-latency audio capturing class utilizing audio input stream provided |
| 6 // by a server (browser) process by use of an IPC interface. | 6 // by a server (browser) process by use of an IPC interface. |
| 7 // | 7 // |
| 8 // Relationship of classes: | 8 // Relationship of classes: |
| 9 // | 9 // |
| 10 // AudioInputController AudioInputDevice | 10 // AudioInputController AudioInputDevice |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 #include <string> | 56 #include <string> |
| 57 | 57 |
| 58 #include "base/basictypes.h" | 58 #include "base/basictypes.h" |
| 59 #include "base/compiler_specific.h" | 59 #include "base/compiler_specific.h" |
| 60 #include "base/memory/scoped_ptr.h" | 60 #include "base/memory/scoped_ptr.h" |
| 61 #include "base/memory/shared_memory.h" | 61 #include "base/memory/shared_memory.h" |
| 62 #include "media/audio/audio_device_thread.h" | 62 #include "media/audio/audio_device_thread.h" |
| 63 #include "media/audio/audio_input_ipc.h" | 63 #include "media/audio/audio_input_ipc.h" |
| 64 #include "media/audio/audio_parameters.h" | 64 #include "media/audio/audio_parameters.h" |
| 65 #include "media/audio/scoped_loop_observer.h" | 65 #include "media/audio/scoped_task_runner_observer.h" |
| 66 #include "media/base/audio_capturer_source.h" | 66 #include "media/base/audio_capturer_source.h" |
| 67 #include "media/base/media_export.h" | 67 #include "media/base/media_export.h" |
| 68 | 68 |
| 69 namespace media { | 69 namespace media { |
| 70 | 70 |
| 71 // TODO(henrika): This class is based on the AudioOutputDevice class and it has | 71 // TODO(henrika): This class is based on the AudioOutputDevice class and it has |
| 72 // many components in common. Investigate potential for re-factoring. | 72 // many components in common. Investigate potential for re-factoring. |
| 73 // See http://crbug.com/179597. | 73 // See http://crbug.com/179597. |
| 74 // TODO(henrika): Add support for event handling (e.g. OnStateChanged, | 74 // TODO(henrika): Add support for event handling (e.g. OnStateChanged, |
| 75 // OnCaptureStopped etc.) and ensure that we can deliver these notifications | 75 // OnCaptureStopped etc.) and ensure that we can deliver these notifications |
| 76 // to any clients using this class. | 76 // to any clients using this class. |
| 77 class MEDIA_EXPORT AudioInputDevice | 77 class MEDIA_EXPORT AudioInputDevice |
| 78 : NON_EXPORTED_BASE(public AudioCapturerSource), | 78 : NON_EXPORTED_BASE(public AudioCapturerSource), |
| 79 NON_EXPORTED_BASE(public AudioInputIPCDelegate), | 79 NON_EXPORTED_BASE(public AudioInputIPCDelegate), |
| 80 NON_EXPORTED_BASE(public ScopedLoopObserver) { | 80 NON_EXPORTED_BASE(public ScopedTaskRunnerObserver) { |
| 81 public: | 81 public: |
| 82 // NOTE: Clients must call Initialize() before using. | 82 // NOTE: Clients must call Initialize() before using. |
| 83 AudioInputDevice(scoped_ptr<AudioInputIPC> ipc, | 83 AudioInputDevice( |
| 84 const scoped_refptr<base::MessageLoopProxy>& io_loop); | 84 scoped_ptr<AudioInputIPC> ipc, |
| 85 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 85 | 86 |
| 86 // AudioCapturerSource implementation. | 87 // AudioCapturerSource implementation. |
| 87 virtual void Initialize(const AudioParameters& params, | 88 virtual void Initialize(const AudioParameters& params, |
| 88 CaptureCallback* callback, | 89 CaptureCallback* callback, |
| 89 int session_id) OVERRIDE; | 90 int session_id) OVERRIDE; |
| 90 virtual void Start() OVERRIDE; | 91 virtual void Start() OVERRIDE; |
| 91 virtual void Stop() OVERRIDE; | 92 virtual void Stop() OVERRIDE; |
| 92 virtual void SetVolume(double volume) OVERRIDE; | 93 virtual void SetVolume(double volume) OVERRIDE; |
| 93 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; | 94 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; |
| 94 | 95 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // TODO(miu): Replace this by changing AudioCapturerSource to accept the | 167 // TODO(miu): Replace this by changing AudioCapturerSource to accept the |
| 167 // callback via Start(). See http://crbug.com/151051 for details. | 168 // callback via Start(). See http://crbug.com/151051 for details. |
| 168 bool stopping_hack_; | 169 bool stopping_hack_; |
| 169 | 170 |
| 170 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 171 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 } // namespace media | 174 } // namespace media |
| 174 | 175 |
| 175 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ | 176 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ |
| OLD | NEW |