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

Side by Side Diff: content/renderer/media/audio_device_factory.cc

Issue 2108673004: Enable renderer-side mixing output of different audio sources basing on finch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment addressed Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/audio_device_factory.h" 5 #include "content/renderer/media/audio_device_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/common/content_constants_internal.h" 10 #include "content/common/content_constants_internal.h"
11 #include "content/renderer/media/audio_input_message_filter.h" 11 #include "content/renderer/media/audio_input_message_filter.h"
12 #include "content/renderer/media/audio_message_filter.h" 12 #include "content/renderer/media/audio_message_filter.h"
13 #include "content/renderer/media/audio_renderer_mixer_manager.h" 13 #include "content/renderer/media/audio_renderer_mixer_manager.h"
14 #include "content/renderer/render_thread_impl.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "media/audio/audio_input_device.h" 15 #include "media/audio/audio_input_device.h"
16 #include "media/audio/audio_output_device.h" 16 #include "media/audio/audio_output_device.h"
17 #include "media/base/audio_renderer_mixer_input.h" 17 #include "media/base/audio_renderer_mixer_input.h"
18 #include "media/base/media_switches.h"
18 #include "url/origin.h" 19 #include "url/origin.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 // static 23 // static
23 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; 24 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL;
24 25
25 namespace { 26 namespace {
26 const int64_t kMaxAuthorizationTimeoutMs = 4000; 27 const int64_t kMaxAuthorizationTimeoutMs = 4000;
27 28
(...skipping 13 matching lines...) Expand all
41 device->RequestDeviceAuthorization(); 42 device->RequestDeviceAuthorization();
42 return device; 43 return device;
43 } 44 }
44 45
45 // This is where we decide which audio will go to mixers and which one to 46 // This is where we decide which audio will go to mixers and which one to
46 // AudioOutpuDevice directly. 47 // AudioOutpuDevice directly.
47 bool IsMixable(AudioDeviceFactory::SourceType source_type) { 48 bool IsMixable(AudioDeviceFactory::SourceType source_type) {
48 if (source_type == AudioDeviceFactory::kSourceMediaElement) 49 if (source_type == AudioDeviceFactory::kSourceMediaElement)
49 return true; // Must ALWAYS go through mixer. 50 return true; // Must ALWAYS go through mixer.
50 51
51 // TODO(olka): make a decision for the rest of the sources basing on OS 52 // Mix everything if experiment is enabled; otherwise mix nothing else.
52 // type and configuration parameters. 53 return base::FeatureList::IsEnabled(media::kNewAudioRenderingMixingStrategy);
53 return false;
54 } 54 }
55 55
56 scoped_refptr<media::SwitchableAudioRendererSink> NewMixableSink( 56 scoped_refptr<media::SwitchableAudioRendererSink> NewMixableSink(
57 int render_frame_id, 57 int render_frame_id,
58 int session_id, 58 int session_id,
59 const std::string& device_id, 59 const std::string& device_id,
60 const url::Origin& security_origin) { 60 const url::Origin& security_origin) {
61 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 61 RenderThreadImpl* render_thread = RenderThreadImpl::current();
62 return scoped_refptr<media::AudioRendererMixerInput>( 62 return scoped_refptr<media::AudioRendererMixerInput>(
63 render_thread->GetAudioRendererMixerManager()->CreateInput( 63 render_thread->GetAudioRendererMixerManager()->CreateInput(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 device_id, security_origin); 177 device_id, security_origin);
178 if (sink) 178 if (sink)
179 return sink; 179 return sink;
180 } 180 }
181 181
182 return NewOutputDevice(render_frame_id, session_id, device_id, 182 return NewOutputDevice(render_frame_id, session_id, device_id,
183 security_origin); 183 security_origin);
184 } 184 }
185 185
186 } // namespace content 186 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698