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

Unified Diff: media/base/audio_bus.cc

Issue 1166483002: Stop enqueueing data to output audio device if consecutive empty buffers are received (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « media/base/audio_bus.h ('k') | media/base/audio_bus_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_bus.cc
diff --git a/media/base/audio_bus.cc b/media/base/audio_bus.cc
index 719dbcd55714c941b5d61f2c13cb56f40269ce2b..e008e15899d191e6a9d793008043092158089114 100644
--- a/media/base/audio_bus.cc
+++ b/media/base/audio_bus.cc
@@ -218,6 +218,20 @@ void AudioBus::Zero() {
ZeroFrames(frames_);
}
+bool AudioBus::AreFramesZero() const {
+ if (frames_ <= 0)
+ return true;
+
+ for (size_t i = 0; i < channel_data_.size(); ++i) {
+ for (int j = 0; j < frames_; j++) {
+ if (*(channel_data_[i] + j) != 0.0f) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
int AudioBus::CalculateMemorySize(const AudioParameters& params) {
return CalculateMemorySizeInternal(
params.channels(), params.frames_per_buffer(), NULL);
« no previous file with comments | « media/base/audio_bus.h ('k') | media/base/audio_bus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698