| 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..bad51caecb82f87e6b4272f6dbba988edaa786e4 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"
|
| @@ -43,6 +44,17 @@ class MEDIA_EXPORT AudioRendererAlgorithm {
|
| // Initializes this object with information about the audio stream.
|
| void Initialize(const AudioParameters& params);
|
|
|
| + // Allows clients to specify which 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. Must
|
| + // only be called after Initialize(); may be called multiple times if the
|
| + // mask changes.
|
| + //
|
| + // 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 SetChannelMask(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|,
|
| // using a variation of the Overlap-Add method to combine sample windows.
|
| @@ -84,6 +96,8 @@ class MEDIA_EXPORT AudioRendererAlgorithm {
|
| // Returns the samples per second for this audio stream.
|
| int samples_per_second() { return samples_per_second_; }
|
|
|
| + std::vector<bool> channel_mask_for_testing() { return channel_mask_; }
|
| +
|
| private:
|
| // Within |search_block_|, find the block of data that is most similar to
|
| // |target_block_|, and write it in |optimal_block_|. This method assumes that
|
| @@ -128,6 +142,11 @@ class MEDIA_EXPORT AudioRendererAlgorithm {
|
| // Converts a time in milliseconds to frames using |samples_per_second_|.
|
| int ConvertMillisecondsToFrames(int ms) const;
|
|
|
| + // Creates or recreates |target_block_wrapper_| and |search_block_wrapper_|
|
| + // after a |channel_mask_| change. May be called at anytime after a channel
|
| + // mask has been specified.
|
| + void CreateSearchWrappers();
|
| +
|
| // Number of channels in audio stream.
|
| int channels_;
|
|
|
| @@ -207,6 +226,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_;
|
|
|