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

Unified Diff: content/renderer/media/audio_renderer_mixer_manager.h

Issue 1769933002: Looking up device id by session id for AudioRendererMixerInput (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment and bug ref to remove AudioManagerBase dependency Created 4 years, 8 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 a245a10294bc02df005fb9408804d4cd82944131..fc182e86a09bcc14b58f8689cbe8181b6f56dccb 100644
--- a/content/renderer/media/audio_renderer_mixer_manager.h
+++ b/content/renderer/media/audio_renderer_mixer_manager.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
+#include "media/audio/audio_manager_base.h"
#include "media/audio/audio_parameters.h"
#include "media/base/output_device_info.h"
#include "url/origin.h"
@@ -47,10 +48,13 @@ class CONTENT_EXPORT AudioRendererMixerManager {
// retrieve an AudioRendererMixer instance from AudioRendererMixerManager.
// |source_render_frame_id| refers to the RenderFrame containing the entity
// rendering the audio. Caller must ensure AudioRendererMixerManager outlives
- // the returned input. |device_id| and |security_origin| identify the output
- // device to use
+ // the returned input. |device_id|, |session_id| and |security_origin|
+ // identify the output device to use. If |device_id| is empty and |session_id|
+ // is nonzero, output device associated with the opened input device
+ // designated by |session_id| is used. Otherwise, |session_id| is ignored.
media::AudioRendererMixerInput* CreateInput(
int source_render_frame_id,
+ int session_id,
const std::string& device_id,
const url::Origin& security_origin);
@@ -102,6 +106,14 @@ class CONTENT_EXPORT AudioRendererMixerManager {
if (a.params.channel_layout() != b.params.channel_layout())
return a.params.channel_layout() < b.params.channel_layout();
+ if (media::AudioManagerBase::IsDefaultDeviceId(a.device_id) &&
+ media::AudioManagerBase::IsDefaultDeviceId(b.device_id)) {
+ // Both device IDs represent the same default device => do not compare
+ // them; the default device is always authorized => ignoring security
+ // origin.
+ return false;
+ }
+
if (a.device_id != b.device_id)
return a.device_id < b.device_id;
« no previous file with comments | « content/renderer/media/audio_message_filter_unittest.cc ('k') | content/renderer/media/audio_renderer_mixer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698