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

Unified Diff: content/renderer/media/media_stream_dependency_factory.cc

Issue 30983002: Switch from using internal constraints to use explicit PeerConnectionFactoryInterface::SetOptions t… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track_stop
Patch Set: Addressed fishmans comments. Created 7 years, 1 month 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
« no previous file with comments | « no previous file | content/renderer/media/rtc_media_constraints.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_dependency_factory.cc
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index f74f22049f0d894227f11c4f961c362d9e47f078..9cb6d3c14823b975cad32c0c0889ff80725d948c 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -305,11 +305,6 @@ void MediaStreamDependencyFactory::CreateNativeMediaSources(
ApplyFixedAudioConstraints(&native_audio_constraints);
WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks;
web_stream->audioTracks(audio_tracks);
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kEnableWebRtcAecRecordings)) {
- native_audio_constraints.AddOptional(
- RTCMediaConstraints::kInternalAecDump, "true");
- }
for (size_t i = 0; i < audio_tracks.size(); ++i) {
const WebKit::WebMediaStreamSource& source = audio_tracks[i].source();
MediaStreamSourceExtraData* source_data =
@@ -523,45 +518,54 @@ bool MediaStreamDependencyFactory::RemoveNativeMediaStreamTrack(
}
bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
+ DCHECK(!pc_factory_.get());
+ DCHECK(!audio_device_.get());
DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()";
- if (!pc_factory_.get()) {
- DCHECK(!audio_device_.get());
- audio_device_ = new WebRtcAudioDeviceImpl();
- scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
- scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
+ scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
+ scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
- const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories =
- RenderThreadImpl::current()->GetGpuFactories();
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories =
+ RenderThreadImpl::current()->GetGpuFactories();
#if !defined(GOOGLE_TV)
- if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) {
- if (gpu_factories)
- decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
- }
+ if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) {
+ if (gpu_factories)
+ decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
+ }
#else
- // PeerConnectionFactory will hold the ownership of this
- // VideoDecoderFactory.
- decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv());
+ // PeerConnectionFactory will hold the ownership of this
+ // VideoDecoderFactory.
+ decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv());
#endif
- if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
- if (gpu_factories)
- encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
- }
+ if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
+ if (gpu_factories)
+ encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
+ }
- scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory(
- webrtc::CreatePeerConnectionFactory(worker_thread_,
- signaling_thread_,
- audio_device_.get(),
- encoder_factory.release(),
- decoder_factory.release()));
- if (factory.get())
- pc_factory_ = factory;
- else
- audio_device_ = NULL;
+ scoped_refptr<WebRtcAudioDeviceImpl> audio_device(
+ new WebRtcAudioDeviceImpl());
+
+ scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory(
+ webrtc::CreatePeerConnectionFactory(worker_thread_,
+ signaling_thread_,
+ audio_device.get(),
+ encoder_factory.release(),
+ decoder_factory.release()));
+ if (!factory.get()) {
+ return false;
}
- return pc_factory_.get() != NULL;
+
+ audio_device_ = audio_device;
+ pc_factory_ = factory;
+ webrtc::PeerConnectionFactoryInterface::Options factory_options;
+ factory_options.enable_aec_dump =
+ cmd_line->HasSwitch(switches::kEnableWebRtcAecRecordings);
+ factory_options.disable_sctp_data_channels =
+ cmd_line->HasSwitch(switches::kDisableSCTPDataChannels);
+ pc_factory_->SetOptions(factory_options);
+ return true;
}
bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
« no previous file with comments | « no previous file | content/renderer/media/rtc_media_constraints.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698