Chromium Code Reviews| Index: ppapi/shared_impl/ppb_audio_shared.cc |
| diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc |
| index 99af9d7e7e20bfece9fd2f2870c13a1d2d2f13d9..05985e9d2ba4f889287b031af225f90a16913db1 100644 |
| --- a/ppapi/shared_impl/ppb_audio_shared.cc |
| +++ b/ppapi/shared_impl/ppb_audio_shared.cc |
| @@ -50,7 +50,9 @@ void AudioCallbackCombined::Run(void* sample_buffer, |
| PPB_Audio_Shared::PPB_Audio_Shared() |
| : playing_(false), |
| + muted_for_power_saver_(false), |
| shared_memory_size_(0), |
| + nacl_thread_id_(0), |
| nacl_thread_active_(false), |
| user_data_(NULL), |
| client_buffer_size_bytes_(0), |
| @@ -197,6 +199,16 @@ void PPB_Audio_Shared::SetThreadFunctions( |
| g_thread_functions = *functions; |
| } |
| +void PPB_Audio_Shared::SetMutedForPowerSaver(bool muted_for_power_saver) { |
| + base::AutoLock lock(mute_lock_); |
| + muted_for_power_saver_ = muted_for_power_saver; |
| +} |
| + |
| +bool PPB_Audio_Shared::IsMutedForPowerSaver() { |
| + base::AutoLock lock(mute_lock_); |
| + return muted_for_power_saver_; |
| +} |
| + |
| // static |
| void PPB_Audio_Shared::CallRun(void* self) { |
| PPB_Audio_Shared* audio = static_cast<PPB_Audio_Shared*>(self); |
| @@ -221,6 +233,10 @@ void PPB_Audio_Shared::Run() { |
| client_buffer_.get(), client_buffer_size_bytes_, latency, user_data_); |
| } |
| + if (IsMutedForPowerSaver()) { |
|
tommycli
2015/01/28 20:41:24
This doesn't actually work!
As far as I can tell,
|
| + memset(client_buffer_.get(), 0, client_buffer_size_bytes_); |
| + } |
| + |
| // Deinterleave the audio data into the shared memory as floats. |
| audio_bus_->FromInterleaved(client_buffer_.get(), |
| audio_bus_->frames(), |