| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 const WebKit::WebMediaConstraints& options) { | 341 const WebKit::WebMediaConstraints& options) { |
| 340 DCHECK(frame_); | 342 DCHECK(frame_); |
| 341 | 343 |
| 342 peer_connection_tracker_ = | 344 peer_connection_tracker_ = |
| 343 RenderThreadImpl::current()->peer_connection_tracker(); | 345 RenderThreadImpl::current()->peer_connection_tracker(); |
| 344 | 346 |
| 345 webrtc::PeerConnectionInterface::IceServers servers; | 347 webrtc::PeerConnectionInterface::IceServers servers; |
| 346 GetNativeIceServers(server_configuration, &servers); | 348 GetNativeIceServers(server_configuration, &servers); |
| 347 | 349 |
| 348 RTCMediaConstraints constraints(options); | 350 RTCMediaConstraints constraints(options); |
| 351 |
| 352 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 353 switches::kEnableSCTPDataChannels)) { |
| 354 // TODO(jiayl): replace the hard coded string with |
| 355 // webrtc::MediaConstraintsInterface::kEnableSctpDataChannels when |
| 356 // the Libjingle change is rolled. |
| 357 constraints.AddOptional("internalSctpDataChannels", "true"); |
| 358 } |
| 359 |
| 349 native_peer_connection_ = | 360 native_peer_connection_ = |
| 350 dependency_factory_->CreatePeerConnection( | 361 dependency_factory_->CreatePeerConnection( |
| 351 servers, &constraints, frame_, this); | 362 servers, &constraints, frame_, this); |
| 352 if (!native_peer_connection_) { | 363 if (!native_peer_connection_) { |
| 353 LOG(ERROR) << "Failed to initialize native PeerConnection."; | 364 LOG(ERROR) << "Failed to initialize native PeerConnection."; |
| 354 return false; | 365 return false; |
| 355 } | 366 } |
| 356 if (peer_connection_tracker_) | 367 if (peer_connection_tracker_) |
| 357 peer_connection_tracker_->RegisterPeerConnection( | 368 peer_connection_tracker_->RegisterPeerConnection( |
| 358 this, servers, constraints, frame_); | 369 this, servers, constraints, frame_); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 webrtc::SessionDescriptionInterface* native_desc = | 760 webrtc::SessionDescriptionInterface* native_desc = |
| 750 dependency_factory_->CreateSessionDescription(type, sdp, error); | 761 dependency_factory_->CreateSessionDescription(type, sdp, error); |
| 751 | 762 |
| 752 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 763 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." |
| 753 << " Type: " << type << " SDP: " << sdp; | 764 << " Type: " << type << " SDP: " << sdp; |
| 754 | 765 |
| 755 return native_desc; | 766 return native_desc; |
| 756 } | 767 } |
| 757 | 768 |
| 758 } // namespace content | 769 } // namespace content |
| OLD | NEW |