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

Unified Diff: media/filters/audio_renderer_algorithm.h

Issue 2536013002: Fix implicit channel layout configurations at non-1.0 playback rates. (Closed)
Patch Set: 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 884259cfe5e22539cf1294510179d1a899f1eb0c..bad51caecb82f87e6b4272f6dbba988edaa786e4 100644
--- a/media/filters/audio_renderer_algorithm.h
+++ b/media/filters/audio_renderer_algorithm.h
@@ -41,16 +41,19 @@ class MEDIA_EXPORT AudioRendererAlgorithm {
AudioRendererAlgorithm();
~AudioRendererAlgorithm();
- // Initializes this object with information about the audio stream. If a
- // channel mask is specified, only these channels will be considered by the
+ // 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.
+ // 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 Initialize(const AudioParameters& params,
- std::vector<bool> channel_mask);
+ 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|,
@@ -93,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
@@ -137,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_;
« 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