| Index: media/audio/audio_input_controller.h
|
| diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h
|
| index 8fd69b0fa6299151822f8bc6ec8c97247ff6cb91..b104d78909b4d57f748d7432cde5a6449587688d 100644
|
| --- a/media/audio/audio_input_controller.h
|
| +++ b/media/audio/audio_input_controller.h
|
| @@ -6,6 +6,7 @@
|
| #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
|
|
|
| #include <string>
|
| +#include "base/atomicops.h"
|
| #include "base/callback.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| @@ -42,23 +43,25 @@
|
| // User AudioInputController EventHandler
|
| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| // CrateLowLatency() ==> DoCreate()
|
| -// AudioManager::MakeAudioInputStream()
|
| -// AudioInputStream::Open()
|
| -// .- - - - - - - - - - - - -> OnError()
|
| -// DoResetNoDataTimer (posted on creating tread)
|
| +// AudioManager::MakeAudioInputStream()
|
| +// AudioInputStream::Open()
|
| +// .- - - - - - - - - - - - -> OnError()
|
| +// create the data timer
|
| // .-------------------------> OnCreated()
|
| // kCreated
|
| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| // Record() ==> DoRecord()
|
| -// AudioInputStream::Start()
|
| +// AudioInputStream::Start()
|
| // .-------------------------> OnRecording()
|
| +// DoResetNoDataTimer()
|
| // kRecording
|
| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| // Close() ==> DoClose()
|
| -// state_ = kClosed
|
| -// AudioInputStream::Stop()
|
| -// AudioInputStream::Close()
|
| -// SyncWriter::Close()
|
| +// delete the data timer
|
| +// state_ = kClosed
|
| +// AudioInputStream::Stop()
|
| +// AudioInputStream::Close()
|
| +// SyncWriter::Close()
|
| // Closure::Run() <--------------.
|
| // (closure-task)
|
| //
|
| @@ -199,14 +202,17 @@ class MEDIA_EXPORT AudioInputController
|
| void DoSetAutomaticGainControl(bool enabled);
|
|
|
| // Methods which ensures that OnError() is triggered when data recording
|
| - // times out. Both are called on the creating thread.
|
| - void DoReportNoDataError();
|
| + // times out. Both are called on the audio thread.
|
| + void DoCheckForNoData();
|
| void DoResetNoDataTimer();
|
|
|
| // Helper method that stops, closes, and NULL:s |*stream_|.
|
| // Signals event when done if the event is not NULL.
|
| void DoStopCloseAndClearStream(base::WaitableEvent* done);
|
|
|
| + void SetDataIsActive(bool enabled);
|
| + bool GetDataIsActive();
|
| +
|
| // Gives access to the message loop of the creating thread.
|
| scoped_refptr<base::MessageLoopProxy> creator_loop_;
|
|
|
| @@ -220,13 +226,19 @@ class MEDIA_EXPORT AudioInputController
|
| // Pointer to the audio input stream object.
|
| AudioInputStream* stream_;
|
|
|
| - // |no_data_timer_| is used to call DoReportNoDataError() when we stop
|
| - // receiving OnData() calls without an OnClose() call. This can occur
|
| + // |no_data_timer_| is used to call OnError() when we stop receiving
|
| + // OnData() calls without an OnClose() call. This can occur
|
| // when an audio input device is unplugged whilst recording on Windows.
|
| // See http://crbug.com/79936 for details.
|
| - // This member is only touched by the creating thread.
|
| + // This member is only touched by the audio thread.
|
| scoped_ptr<base::DelayTimer<AudioInputController> > no_data_timer_;
|
|
|
| + // This flag is used to signal that we are receiving OnData() calls, i.e,
|
| + // that data is active. It can be touched by the audio thread and by the
|
| + // low-level audio thread which calls OnData(). E.g. on Windows, the
|
| + // low-level audio thread is called wasapi_capture_thread.
|
| + base::subtle::Atomic32 data_is_active_;
|
| +
|
| // |state_| is written on the audio thread and is read on the hardware audio
|
| // thread. These operations need to be locked. But lock is not required for
|
| // reading on the audio input controller thread.
|
|
|