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

Unified Diff: media/base/audio_renderer_mixer.h

Issue 2067863003: Mixing audio with different latency requirements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing bot redness Created 4 years, 6 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
Index: media/base/audio_renderer_mixer.h
diff --git a/media/base/audio_renderer_mixer.h b/media/base/audio_renderer_mixer.h
index bdffef24b6e63a9ec239b8012cdf6dc95b4ca594..0198d61c784d897942e02595815aa6ffc90f5c07 100644
--- a/media/base/audio_renderer_mixer.h
+++ b/media/base/audio_renderer_mixer.h
@@ -26,8 +26,11 @@ namespace media {
class MEDIA_EXPORT AudioRendererMixer
: NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback) {
public:
+ typedef base::Callback<void(int)> UmaLogCallback;
+
AudioRendererMixer(const AudioParameters& output_params,
- scoped_refptr<AudioRendererSink> sink);
+ scoped_refptr<AudioRendererSink> sink,
+ const UmaLogCallback& log_callback);
~AudioRendererMixer() override;
// Add or remove a mixer input from mixing; called by AudioRendererMixerInput.
@@ -51,7 +54,13 @@ class MEDIA_EXPORT AudioRendererMixer
// Returns true if called on rendering thread, otherwise false.
bool CurrentThreadIsRenderingThread();
+ void LogLifetimeUmaStats();
+
+ const AudioParameters& GetOutputParamsForTesting() { return output_params_; };
+
private:
+ class UMAMaxValueTracker;
+
// Maps input sample rate to the dedicated converter.
using AudioConvertersMap =
std::map<int, std::unique_ptr<LoopbackAudioConverter>>;
@@ -94,6 +103,10 @@ class MEDIA_EXPORT AudioRendererMixer
base::TimeTicks last_play_time_;
bool playing_;
+ // Tracks the maximum number of simultaneous mixer inputs and logs it into
+ // UMA histogram upon the destruction.
+ std::unique_ptr<UMAMaxValueTracker> input_count_tracker_;
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer);
};

Powered by Google App Engine
This is Rietveld 408576698