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

Unified Diff: media/filters/audio_renderer_algorithm.h

Issue 2522673003: Don't run WSOLA over always muted channels. (Closed)
Patch Set: Fix cast tests. Created 4 years, 1 month 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/cast/test/fake_media_source.cc ('k') | media/filters/audio_renderer_algorithm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_algorithm.h
diff --git a/media/filters/audio_renderer_algorithm.h b/media/filters/audio_renderer_algorithm.h
index 398198ab2b81be95c1c0636997103d0b78e00c2c..884259cfe5e22539cf1294510179d1a899f1eb0c 100644
--- a/media/filters/audio_renderer_algorithm.h
+++ b/media/filters/audio_renderer_algorithm.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include <memory>
+#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -40,8 +41,16 @@ class MEDIA_EXPORT AudioRendererAlgorithm {
AudioRendererAlgorithm();
~AudioRendererAlgorithm();
- // Initializes this object with information about the audio stream.
- void Initialize(const AudioParameters& params);
+ // Initializes this object with information about the audio stream. If a
+ // channel mask is specified, only these channels will be considered by the
+ // algorithm when adapting for playback rate, other channels will be muted.
+ // Useful to avoid performance overhead of the adapatation algorithm.
+ //
+ // E.g., If |channel_mask| is [true, false] only the first channel will be
+ // used to construct the playback rate adapated signal. This is useful if
+ // channel upmixing has been performed prior to this point.
+ void Initialize(const AudioParameters& params,
+ std::vector<bool> channel_mask);
// Tries to fill |requested_frames| frames into |dest| with possibly scaled
// data from our |audio_buffer_|. Data is scaled based on |playback_rate|,
@@ -207,6 +216,13 @@ class MEDIA_EXPORT AudioRendererAlgorithm {
// |target_block_|.
std::unique_ptr<AudioBus> target_block_;
+ // Active channels to consider while searching. Used to speed up WSOLA
+ // processing by ignoring always muted channels. Wrappers are always
+ // constructed during Initialize() and have <= |channels_|.
+ std::vector<bool> channel_mask_;
+ std::unique_ptr<AudioBus> search_block_wrapper_;
+ std::unique_ptr<AudioBus> target_block_wrapper_;
+
// The initial and maximum capacity calculated by Initialize().
int initial_capacity_;
int max_capacity_;
« no previous file with comments | « media/cast/test/fake_media_source.cc ('k') | media/filters/audio_renderer_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698