Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" | |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "content/public/common/content_switches.h" | |
| 15 #include "content/renderer/media/media_stream_dependency_factory.h" | 17 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 16 #include "content/renderer/media/peer_connection_tracker.h" | 18 #include "content/renderer/media/peer_connection_tracker.h" |
| 17 #include "content/renderer/media/remote_media_stream_impl.h" | 19 #include "content/renderer/media/remote_media_stream_impl.h" |
| 18 #include "content/renderer/media/rtc_data_channel_handler.h" | 20 #include "content/renderer/media/rtc_data_channel_handler.h" |
| 19 #include "content/renderer/media/rtc_dtmf_sender_handler.h" | 21 #include "content/renderer/media/rtc_dtmf_sender_handler.h" |
| 20 #include "content/renderer/media/rtc_media_constraints.h" | 22 #include "content/renderer/media/rtc_media_constraints.h" |
| 21 #include "content/renderer/render_thread_impl.h" | 23 #include "content/renderer/render_thread_impl.h" |
| 22 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" | 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" |
| 23 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. | 25 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. |
| 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" | 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 | 333 |
| 332 void RTCPeerConnectionHandler::associateWithFrame(WebKit::WebFrame* frame) { | 334 void RTCPeerConnectionHandler::associateWithFrame(WebKit::WebFrame* frame) { |
| 333 DCHECK(frame); | 335 DCHECK(frame); |
| 334 frame_ = frame; | 336 frame_ = frame; |
| 335 } | 337 } |
| 336 | 338 |
| 337 bool RTCPeerConnectionHandler::initialize( | 339 bool RTCPeerConnectionHandler::initialize( |
| 338 const WebKit::WebRTCConfiguration& server_configuration, | 340 const WebKit::WebRTCConfiguration& server_configuration, |
| 339 const WebKit::WebMediaConstraints& options) { | 341 const WebKit::WebMediaConstraints& options) { |
| 340 DCHECK(frame_); | 342 DCHECK(frame_); |
| 343 static bool sctp_data_channel_enabled = | |
|
tommi (sloooow) - chröme
2013/05/21 08:03:24
nit: no need to cache this in a static. initialize
jiayl
2013/05/21 16:57:15
Done.
| |
| 344 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 345 switches::kEnableSCTPDataChannels); | |
| 341 | 346 |
| 342 peer_connection_tracker_ = | 347 peer_connection_tracker_ = |
| 343 RenderThreadImpl::current()->peer_connection_tracker(); | 348 RenderThreadImpl::current()->peer_connection_tracker(); |
| 344 | 349 |
| 345 webrtc::PeerConnectionInterface::IceServers servers; | 350 webrtc::PeerConnectionInterface::IceServers servers; |
| 346 GetNativeIceServers(server_configuration, &servers); | 351 GetNativeIceServers(server_configuration, &servers); |
| 347 | 352 |
| 348 RTCMediaConstraints constraints(options); | 353 RTCMediaConstraints constraints(options); |
| 354 | |
| 355 if (sctp_data_channel_enabled) { | |
| 356 // TODO(jiayl): replace the hard coded string with | |
| 357 // webrtc::MediaConstraintsInterface::kEnbaleSctpDataChannels when | |
|
tommi (sloooow) - chröme
2013/05/21 08:03:24
s/kEnbale/kEnable
jiayl
2013/05/21 16:57:15
Done.
| |
| 358 // the Libjingle change is rolled. | |
|
tommi (sloooow) - chröme
2013/05/21 08:03:24
when will the libjingle change be rolled? Could w
jiayl
2013/05/21 16:57:15
The libjingle CL adding these strings depends on a
| |
| 359 constraints.AddOptional("internalSctpDataChannels", "true"); | |
| 360 } | |
| 361 | |
| 349 native_peer_connection_ = | 362 native_peer_connection_ = |
| 350 dependency_factory_->CreatePeerConnection( | 363 dependency_factory_->CreatePeerConnection( |
| 351 servers, &constraints, frame_, this); | 364 servers, &constraints, frame_, this); |
| 352 if (!native_peer_connection_) { | 365 if (!native_peer_connection_) { |
| 353 LOG(ERROR) << "Failed to initialize native PeerConnection."; | 366 LOG(ERROR) << "Failed to initialize native PeerConnection."; |
| 354 return false; | 367 return false; |
| 355 } | 368 } |
| 356 if (peer_connection_tracker_) | 369 if (peer_connection_tracker_) |
| 357 peer_connection_tracker_->RegisterPeerConnection( | 370 peer_connection_tracker_->RegisterPeerConnection( |
| 358 this, servers, constraints, frame_); | 371 this, servers, constraints, frame_); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 webrtc::SessionDescriptionInterface* native_desc = | 762 webrtc::SessionDescriptionInterface* native_desc = |
| 750 dependency_factory_->CreateSessionDescription(type, sdp, error); | 763 dependency_factory_->CreateSessionDescription(type, sdp, error); |
| 751 | 764 |
| 752 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 765 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." |
| 753 << " Type: " << type << " SDP: " << sdp; | 766 << " Type: " << type << " SDP: " << sdp; |
| 754 | 767 |
| 755 return native_desc; | 768 return native_desc; |
| 756 } | 769 } |
| 757 | 770 |
| 758 } // namespace content | 771 } // namespace content |
| OLD | NEW |