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

Unified Diff: content/renderer/media/audio_renderer_mixer_manager.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: content/renderer/media/audio_renderer_mixer_manager.h
diff --git a/content/renderer/media/audio_renderer_mixer_manager.h b/content/renderer/media/audio_renderer_mixer_manager.h
index 5a93351fde6174afac4804c4d64cc533018c6f57..fc975ab9ffa59e822534ea24056c6732f9ebb1a5 100644
--- a/content/renderer/media/audio_renderer_mixer_manager.h
+++ b/content/renderer/media/audio_renderer_mixer_manager.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_
#define CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_
+#include <bitset>
#include <map>
#include <memory>
#include <string>
@@ -13,6 +14,7 @@
#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
#include "media/audio/audio_device_description.h"
+#include "media/base/audio_latency.h"
#include "media/base/audio_parameters.h"
#include "media/base/audio_renderer_mixer_pool.h"
#include "media/base/output_device_info.h"
@@ -61,21 +63,20 @@ class CONTENT_EXPORT AudioRendererMixerManager
int source_render_frame_id,
int session_id,
const std::string& device_id,
- const url::Origin& security_origin);
+ const url::Origin& security_origin,
+ media::AudioLatency::LatencyType latency);
// AudioRendererMixerPool implementation.
media::AudioRendererMixer* GetMixer(
int source_render_frame_id,
- const media::AudioParameters& params,
+ const media::AudioParameters& input_params,
+ media::AudioLatency::LatencyType latency,
const std::string& device_id,
const url::Origin& security_origin,
media::OutputDeviceStatus* device_status) final;
- void ReturnMixer(int source_render_frame_id,
- const media::AudioParameters& params,
- const std::string& device_id,
- const url::Origin& security_origin) final;
+ void ReturnMixer(media::AudioRendererMixer* mixer) final;
media::OutputDeviceInfo GetOutputDeviceInfo(
int source_render_frame_id,
@@ -95,11 +96,13 @@ class CONTENT_EXPORT AudioRendererMixerManager
struct MixerKey {
MixerKey(int source_render_frame_id,
const media::AudioParameters& params,
+ media::AudioLatency::LatencyType latency,
const std::string& device_id,
const url::Origin& security_origin);
MixerKey(const MixerKey& other);
int source_render_frame_id;
media::AudioParameters params;
+ media::AudioLatency::LatencyType latency;
std::string device_id;
url::Origin security_origin;
};
@@ -113,6 +116,13 @@ class CONTENT_EXPORT AudioRendererMixerManager
if (a.params.channels() != b.params.channels())
return a.params.channels() < b.params.channels();
+ if (a.latency != b.latency)
+ return a.latency < b.latency;
+
+ // TODO(olka) add buffer duration comparison for LATENCY_EXACT_MS when
+ // adding support for it.
+ DCHECK_NE(media::AudioLatency::LATENCY_EXACT_MS, a.latency);
+
// Ignore effects(), bits_per_sample(), format(), and frames_per_buffer(),
// these parameters do not affect mixer reuse. All AudioRendererMixer
// units disable FIFO, so frames_per_buffer() can be safely ignored.
@@ -154,6 +164,9 @@ class CONTENT_EXPORT AudioRendererMixerManager
// Mixer sink cache.
const std::unique_ptr<AudioRendererSinkCache> sink_cache_;
+ // Map of the output latencies encountered throughout mixer manager lifetime.
+ std::bitset<media::AudioLatency::LATENCY_COUNT> latency_map_;
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerManager);
};

Powered by Google App Engine
This is Rietveld 408576698