Index: media/audio/audio_input_device.h |
diff --git a/media/audio/audio_input_device.h b/media/audio/audio_input_device.h |
index b62445701f033a6c4ab2ba9fd305c15ca7fbecf6..a633d4c30ccd439ad9edf455bd9525ed5414ee8e 100644 |
--- a/media/audio/audio_input_device.h |
+++ b/media/audio/audio_input_device.h |
@@ -59,6 +59,8 @@ |
#include "base/compiler_specific.h" |
#include "base/macros.h" |
#include "base/memory/shared_memory.h" |
+#include "base/time/time.h" |
+#include "base/timer/timer.h" |
#include "media/audio/audio_device_thread.h" |
#include "media/audio/audio_input_ipc.h" |
#include "media/audio/scoped_task_runner_observer.h" |
@@ -128,6 +130,18 @@ class MEDIA_EXPORT AudioInputDevice |
// If the IO loop dies before we do, we shut down the audio thread from here. |
void WillDestroyCurrentMessageLoop() override; |
+ // Checks if we have gotten callbacks within a certain time period. If no |
+ // callbacks have been received, we report a capture error to the capture |
+ // callback. Must be called on IO thread. |
+ void CheckIfInputStreamIsAlive(); |
+ |
+ // Sets the last callback time |last_callback_time_|. |
+ // SetLastCallbackTime() is called by AudioInputDevice::AudioThreadCallback on |
+ // the audio thread and posts a task to SetLastCallbackTimeOnIOThread() which |
+ // sets the variable. |
+ void SetLastCallbackTime(base::TimeTicks last_callback_time); |
+ void SetLastCallbackTimeOnIOThread(base::TimeTicks last_callback_time); |
+ |
AudioParameters audio_parameters_; |
CaptureCallback* callback_; |
@@ -166,6 +180,13 @@ class MEDIA_EXPORT AudioInputDevice |
// callback via Start(). See http://crbug.com/151051 for details. |
bool stopping_hack_; |
+ // Mechanism for detecting if we don't get callbacks when started. |
+ // |check_alive_timer_| runs the check regularly. |
+ // |last_callback_time_| stores the time for the last callback. |
+ // Both must only be accessed on the IO thread. |
+ base::RepeatingTimer check_alive_timer_; |
+ base::TimeTicks last_callback_time_; |
+ |
DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
}; |