Chromium Code Reviews| 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..327b7c4e30853dc3a705d35f85419d142d97759d 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,17 @@ 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 for some period of time. |
| + // |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_; |
| + |
| + // Flags that missing callbacks has been detected. Used for statistics, |
| + // reported when stopping. Must only be accessed on the IO thread. |
|
ossu-chromium
2017/05/22 11:27:35
Aren't there annotations to enforce that?
Henrik Grunell
2017/05/22 15:04:54
Nope.
|
| + bool missing_callbacks_detected_; |
| + |
| DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
| }; |