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

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

Issue 2645613005: MediaStreamTrack: Add echo-cancellation and device-id to getSettings (Closed)
Patch Set: Created 3 years, 11 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
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/webaudio_media_stream_source.h" 5 #include "content/renderer/media/webaudio_media_stream_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 WebAudioMediaStreamSource::WebAudioMediaStreamSource( 13 WebAudioMediaStreamSource::WebAudioMediaStreamSource(
14 blink::WebMediaStreamSource* blink_source) 14 blink::WebMediaStreamSource* blink_source)
15 : MediaStreamAudioSource(false /* is_remote */), 15 : MediaStreamAudioSource(false /* is_remote */),
16 is_registered_consumer_(false), 16 is_registered_consumer_(false),
17 fifo_(base::Bind(&WebAudioMediaStreamSource::DeliverRebufferedAudio, 17 fifo_(base::Bind(&WebAudioMediaStreamSource::DeliverRebufferedAudio,
18 base::Unretained(this))), 18 base::Unretained(this))),
19 blink_source_(*blink_source) { 19 blink_source_(*blink_source) {
20 DVLOG(1) << "WebAudioMediaStreamSource::WebAudioMediaStreamSource()"; 20 DVLOG(1) << "WebAudioMediaStreamSource::WebAudioMediaStreamSource()";
21 } 21 }
22 22
23 WebAudioMediaStreamSource::~WebAudioMediaStreamSource() { 23 WebAudioMediaStreamSource::~WebAudioMediaStreamSource() {
24 DVLOG(1) << "WebAudioMediaStreamSource::~WebAudioMediaStreamSource()"; 24 DVLOG(1) << "WebAudioMediaStreamSource::~WebAudioMediaStreamSource()";
25 EnsureSourceIsStopped(); 25 EnsureSourceIsStopped();
26 } 26 }
27 27
28 void WebAudioMediaStreamSource::getSettings(
29 blink::WebMediaStreamTrack::Settings& settings) {
30 // This source type does not support echo cancellation.
31 settings.setEchoCancellation(false);
32 }
33
28 void WebAudioMediaStreamSource::setFormat(size_t number_of_channels, 34 void WebAudioMediaStreamSource::setFormat(size_t number_of_channels,
29 float sample_rate) { 35 float sample_rate) {
30 DCHECK(thread_checker_.CalledOnValidThread()); 36 DCHECK(thread_checker_.CalledOnValidThread());
31 VLOG(1) << "WebAudio media stream source changed format to: channels=" 37 VLOG(1) << "WebAudio media stream source changed format to: channels="
32 << number_of_channels << ", sample_rate=" << sample_rate; 38 << number_of_channels << ", sample_rate=" << sample_rate;
33 39
34 // If the channel count is greater than 8, use discrete layout. However, 40 // If the channel count is greater than 8, use discrete layout. However,
35 // anything beyond 8 is ignored by some audio tracks/sinks. 41 // anything beyond 8 is ignored by some audio tracks/sinks.
36 media::ChannelLayout channel_layout = 42 media::ChannelLayout channel_layout =
37 number_of_channels > 8 ? media::CHANNEL_LAYOUT_DISCRETE 43 number_of_channels > 8 ? media::CHANNEL_LAYOUT_DISCRETE
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 int frame_delay) { 108 int frame_delay) {
103 const base::TimeTicks reference_time = 109 const base::TimeTicks reference_time =
104 current_reference_time_ + 110 current_reference_time_ +
105 base::TimeDelta::FromMicroseconds( 111 base::TimeDelta::FromMicroseconds(
106 frame_delay * base::Time::kMicrosecondsPerSecond / 112 frame_delay * base::Time::kMicrosecondsPerSecond /
107 MediaStreamAudioSource::GetAudioParameters().sample_rate()); 113 MediaStreamAudioSource::GetAudioParameters().sample_rate());
108 MediaStreamAudioSource::DeliverDataToTracks(audio_bus, reference_time); 114 MediaStreamAudioSource::DeliverDataToTracks(audio_bus, reference_time);
109 } 115 }
110 116
111 } // namespace content 117 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698