summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 15:22:47 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 15:22:47 +0000
commit423b6d68c4ad554805d3248d352caa7f8fd188b4 (patch)
tree32c3653199e577d3f144becce8fe4db1317f4ec7
parent457b33a7ad1bfbd863c4b7ed7dc902d2dbdab353 (diff)
downloadchromium_src-423b6d68c4ad554805d3248d352caa7f8fd188b4.zip
chromium_src-423b6d68c4ad554805d3248d352caa7f8fd188b4.tar.gz
chromium_src-423b6d68c4ad554805d3248d352caa7f8fd188b4.tar.bz2
Actually set default audio constraints for getUserMedia streams with audio.
The previous CL set the constraints on the Chrome source object but the WebKit source does not get updated, so we need to apply the settings in one more place. :( BUG=289396 R=xians@chromium.org Review URL: https://codereview.chromium.org/23686028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223876 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/media/media_stream_dependency_factory.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index 17b774c..9280d5c 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -282,10 +282,8 @@ void MediaStreamDependencyFactory::CreateNativeMediaSources(
continue;
}
const bool is_screencast =
- source_data->device_info().device.type ==
- content::MEDIA_TAB_VIDEO_CAPTURE ||
- source_data->device_info().device.type ==
- content::MEDIA_DESKTOP_VIDEO_CAPTURE;
+ source_data->device_info().device.type == MEDIA_TAB_VIDEO_CAPTURE ||
+ source_data->device_info().device.type == MEDIA_DESKTOP_VIDEO_CAPTURE;
source_data->SetVideoSource(
CreateLocalVideoSource(source_data->device_info().session_id,
is_screencast,
@@ -396,6 +394,16 @@ bool MediaStreamDependencyFactory::AddNativeMediaStreamTrack(
// right now they're on the source, so we fetch them from there.
RTCMediaConstraints track_constraints(source.constraints());
+ WebKit::WebMediaStreamSource::Type type = track.source().type();
+ DCHECK(type == WebKit::WebMediaStreamSource::TypeAudio ||
+ type == WebKit::WebMediaStreamSource::TypeVideo);
+
+ if (type == WebKit::WebMediaStreamSource::TypeAudio) {
+ // Apply default audio constraints that enable echo cancellation,
+ // automatic gain control, noise suppression and high-pass filter.
+ ApplyFixedAudioConstraints(&track_constraints);
+ }
+
scoped_refptr<WebAudioCapturerSource> webaudio_source;
if (!source_data) {
if (source.requiresAudioConsumer()) {
@@ -412,10 +420,6 @@ bool MediaStreamDependencyFactory::AddNativeMediaStreamTrack(
}
}
- WebKit::WebMediaStreamSource::Type type = track.source().type();
- DCHECK(type == WebKit::WebMediaStreamSource::TypeAudio ||
- type == WebKit::WebMediaStreamSource::TypeVideo);
-
std::string track_id = UTF16ToUTF8(track.id());
if (source.type() == WebKit::WebMediaStreamSource::TypeAudio) {
scoped_refptr<WebRtcAudioCapturer> capturer;
@@ -626,15 +630,10 @@ MediaStreamDependencyFactory::CreateWebAudioSource(
scoped_refptr<WebAudioCapturerSource>
webaudio_capturer_source(new WebAudioCapturerSource());
- MediaStreamSourceExtraData* source_data =
- new content::MediaStreamSourceExtraData();
+ MediaStreamSourceExtraData* source_data = new MediaStreamSourceExtraData();
// Create a LocalAudioSource object which holds audio options.
- // Use audio constraints where all values are true, i.e., enable
- // echo cancellation, automatic gain control, noise suppression and
- // high-pass filter. SetLocalAudioSource() affects core audio parts in
- // third_party/Libjingle.
- ApplyFixedAudioConstraints(constraints);
+ // SetLocalAudioSource() affects core audio parts in third_party/Libjingle.
source_data->SetLocalAudioSource(CreateLocalAudioSource(constraints).get());
source->setExtraData(source_data);