Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(888)

Unified Diff: media/renderers/audio_renderer_impl.h

Issue 2089503002: Merge M52: "Freeze media time and audio rendering when the system suspends." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/renderers/audio_renderer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/audio_renderer_impl.h
diff --git a/media/renderers/audio_renderer_impl.h b/media/renderers/audio_renderer_impl.h
index 3412c0cb0e65dc49e2393b1010e22e530970d444..b5384e56c5174014ab19872c923cee040c54e443 100644
--- a/media/renderers/audio_renderer_impl.h
+++ b/media/renderers/audio_renderer_impl.h
@@ -26,6 +26,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/power_monitor/power_observer.h"
#include "base/synchronization/lock.h"
#include "media/base/audio_decoder.h"
#include "media/base/audio_renderer.h"
@@ -53,6 +54,7 @@ class DecryptingDemuxerStream;
class MEDIA_EXPORT AudioRendererImpl
: public AudioRenderer,
public TimeSource,
+ public base::PowerObserver,
NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback) {
public:
// |task_runner| is the thread on which AudioRendererImpl will execute.
@@ -88,6 +90,10 @@ class MEDIA_EXPORT AudioRendererImpl
void StartPlaying() override;
void SetVolume(float volume) override;
+ // base::PowerObserver implementation.
+ void OnSuspend() override;
+ void OnResume() override;
+
private:
friend class AudioRendererImplTest;
@@ -289,6 +295,10 @@ class MEDIA_EXPORT AudioRendererImpl
// reported to JavaScript from going backwards in time.
base::TimeDelta last_media_timestamp_;
+ // Set by OnSuspend() and OnResume() to indicate when the system is about to
+ // suspend/is suspended and when it resumes.
+ bool is_suspending_;
+
// End variables which must be accessed under |lock_|. ----------------------
// NOTE: Weak pointers must be invalidated before all other member variables.
« no previous file with comments | « no previous file | media/renderers/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698