Index: content/renderer/media/audio_input_device.h |
diff --git a/content/renderer/media/audio_input_device.h b/content/renderer/media/audio_input_device.h |
index 8ef72b7e277704866cce16215f96b760ab671ad3..b98d2c28ed74731dbbfc4d41b183fce0cfa9edb8 100644 |
--- a/content/renderer/media/audio_input_device.h |
+++ b/content/renderer/media/audio_input_device.h |
@@ -61,7 +61,7 @@ |
// Implementation notes: |
// |
// - Start() is asynchronous/non-blocking. |
-// - Stop() is synchronous/blocking. |
+// - Stop() is asynchronous/non-blocking. |
// - SetDevice() is asynchronous/non-blocking. |
// - The user must call Stop() before deleting the class instance. |
@@ -87,7 +87,7 @@ |
// OnCaptureStopped etc.) and ensure that we can deliver these notifications |
// to any clients using this class. |
class CONTENT_EXPORT AudioInputDevice |
- : public AudioInputMessageFilter::Delegate, |
+ : NON_EXPORTED_BASE(public media::AudioInputIPCDelegate), |
NON_EXPORTED_BASE(public ScopedLoopObserver), |
public base::RefCountedThreadSafe<AudioInputDevice> { |
public: |
@@ -117,9 +117,12 @@ class CONTENT_EXPORT AudioInputDevice |
}; |
// Methods called on main render thread ------------------------------------- |
- AudioInputDevice(const media::AudioParameters& params, |
- CaptureCallback* callback, |
- CaptureEventHandler* event_handler); |
+ AudioInputDevice(media::AudioInputDeviceIPC* ipc, |
+ const scoped_refptr<base::MessageLoopProxy>& io_loop); |
+ |
+ void Initialize(const media::AudioParameters& params, |
+ CaptureCallback* callback, |
+ CaptureEventHandler* event_handler); |
// Specify the |session_id| to query which device to use. This method is |
// asynchronous/non-blocking. |
@@ -142,13 +145,9 @@ class CONTENT_EXPORT AudioInputDevice |
// Returns |true| on success. |
bool GetVolume(double* volume); |
- double sample_rate() const { |
- return audio_parameters_.sample_rate(); |
- } |
+ double sample_rate() const { return audio_parameters_.sample_rate(); } |
scherkus (not reviewing)
2012/07/25 17:43:37
remove extra spacing at end
tommi (sloooow) - chröme
2012/07/25 20:10:27
Done.
|
- int buffer_size() const { |
- return audio_parameters_.frames_per_buffer(); |
- } |
+ int buffer_size() const { return audio_parameters_.frames_per_buffer(); } |
// Sets the Automatic Gain Control state to on or off. |
// This method must be called before Start(). It will not have any effect |
@@ -156,13 +155,15 @@ class CONTENT_EXPORT AudioInputDevice |
void SetAutomaticGainControl(bool enabled); |
// Methods called on IO thread ---------------------------------------------- |
- // AudioInputMessageFilter::Delegate impl., called by AudioInputMessageFilter. |
+ // media::AudioInputIPCDelegate implementation. |
virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
base::SyncSocket::Handle socket_handle, |
- uint32 length) OVERRIDE; |
+ int length) OVERRIDE; |
virtual void OnVolume(double volume) OVERRIDE; |
- virtual void OnStateChanged(AudioStreamState state) OVERRIDE; |
+ virtual void OnStateChanged( |
+ media::AudioInputIPCDelegate::State state) OVERRIDE; |
virtual void OnDeviceReady(const std::string& device_id) OVERRIDE; |
+ virtual void OnIPCClosed() OVERRIDE; |
protected: |
virtual ~AudioInputDevice(); |
@@ -181,8 +182,6 @@ class CONTENT_EXPORT AudioInputDevice |
void SetVolumeOnIOThread(double volume); |
void SetAutomaticGainControlOnIOThread(bool enabled); |
- void Send(IPC::Message* message); |
- |
// MessageLoop::DestructionObserver implementation for the IO loop. |
// If the IO loop dies before we do, we shut down the audio thread from here. |
virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
@@ -193,14 +192,10 @@ class CONTENT_EXPORT AudioInputDevice |
CaptureCallback* callback_; |
CaptureEventHandler* event_handler_; |
- // The current volume scaling [0.0, 1.0] of the audio stream. |
- double volume_; |
- |
- // Cached audio input message filter (lives on the main render thread). |
- scoped_refptr<AudioInputMessageFilter> filter_; |
+ media::AudioInputDeviceIPC* ipc_; |
// Our stream ID on the message filter. Only modified on the IO thread. |
- int32 stream_id_; |
+ int stream_id_; |
// The media session ID used to identify which input device to be started. |
// Only modified on the IO thread. |