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

Unified Diff: ppapi/shared_impl/ppb_audio_shared.h

Issue 879403002: Plugin Power Saver: Mute throttled plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: ppapi/shared_impl/ppb_audio_shared.h
diff --git a/ppapi/shared_impl/ppb_audio_shared.h b/ppapi/shared_impl/ppb_audio_shared.h
index 31888c882645fded45167c6de33fe941f97506d9..cad9a554d52fd9ddb8b22529b89cb26a52164cb5 100644
--- a/ppapi/shared_impl/ppb_audio_shared.h
+++ b/ppapi/shared_impl/ppb_audio_shared.h
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
+#include "base/synchronization/lock.h"
#include "base/threading/simple_thread.h"
#include "media/base/audio_bus.h"
#include "ppapi/c/ppb_audio.h"
@@ -92,6 +93,13 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared
// into user code.
static void SetThreadFunctions(const struct PP_ThreadFunctions* functions);
+ protected:
+ // Configures if we zero out the audio buffers after each audio callback.
+ // This is a stopgap to mute individual plugins that in power saver mode.
+ void SetMutedForPowerSaver(bool muted_for_power_saver);
+
+ bool IsMutedForPowerSaver();
+
private:
// Starts execution of the audio thread.
void StartThread();
@@ -105,6 +113,10 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared
// True if playing the stream.
bool playing_;
+ // True if we mute the stream while continuing to play it (for power saver).
+ volatile bool muted_for_power_saver_;
piman 2015/01/28 21:58:50 Why volatile?
+ base::Lock mute_lock_;
+
// Socket used to notify us when audio is ready to accept new samples. This
// pointer is created in StreamCreated().
scoped_ptr<base::CancelableSyncSocket> socket_;

Powered by Google App Engine
This is Rietveld 408576698