Index: content/renderer/media/renderer_webaudiodevice_impl.h |
diff --git a/content/renderer/media/renderer_webaudiodevice_impl.h b/content/renderer/media/renderer_webaudiodevice_impl.h |
index 13ce0f15948ed6ae16f24e70dac458e5f20cc975..de97a50a75de8e01652ba6706f8dd0788d571452 100644 |
--- a/content/renderer/media/renderer_webaudiodevice_impl.h |
+++ b/content/renderer/media/renderer_webaudiodevice_impl.h |
@@ -6,14 +6,21 @@ |
#define CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "base/threading/thread_checker.h" |
#include "media/audio/audio_parameters.h" |
#include "media/base/audio_renderer_sink.h" |
#include "third_party/WebKit/public/platform/WebAudioDevice.h" |
#include "third_party/WebKit/public/platform/WebVector.h" |
+namespace base { |
+class SingleThreadTaskRunner; |
+} |
+ |
namespace media { |
class AudioOutputDevice; |
+class AudioTimestampHelper; |
+class NullAudioSink; |
} |
namespace content { |
@@ -38,6 +45,10 @@ class RendererWebAudioDeviceImpl |
void OnRenderError() override; |
private: |
+ // Helper method to start and stop the |null_audio_sink_|. |
+ void StartNullAudioSink(); |
+ void StopNullAudioSink(); |
+ |
const media::AudioParameters params_; |
// Weak reference to the callback into WebKit code. |
@@ -53,6 +64,24 @@ class RendererWebAudioDeviceImpl |
// ID to allow browser to select the correct input device for unified IO. |
int session_id_; |
+ // Object to calculate the period of time in silence. |
+ scoped_ptr<media::AudioTimestampHelper> audio_timestamp_helper_; |
+ |
+ // TaskRunner to post callbacks to the render thread. |
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
+ |
+ // A fake audio sink object that consumes data when long period of silence |
+ // audio is detected. This object lives on the render thread. |
+ scoped_refptr<media::NullAudioSink> null_audio_sink_; |
+ |
+ // Whether audio output is directed to |null_audio_sink_|. |
+ bool is_using_null_audio_sink_; |
+ |
+ // Weak pointer for posting callbacks. |
+ base::WeakPtr<RendererWebAudioDeviceImpl> weak_this_; |
+ // NOTE: Weak pointers must be invalidated before all other member variables. |
+ base::WeakPtrFactory<RendererWebAudioDeviceImpl> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); |
}; |