diff options
author | perkj@chromium.org <perkj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 17:20:40 +0000 |
---|---|---|
committer | perkj@chromium.org <perkj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 17:20:40 +0000 |
commit | 275cc06144eeb80f766bb62aac14fc4d3a85a01e (patch) | |
tree | 08e660f64cac642563e836834eaba6e02ef2961f /content/renderer/media/rtc_peer_connection_handler.cc | |
parent | 7e18fe1ea62bff56e9c8e6cac9c57a17170d4020 (diff) | |
download | chromium_src-275cc06144eeb80f766bb62aac14fc4d3a85a01e.zip chromium_src-275cc06144eeb80f766bb62aac14fc4d3a85a01e.tar.gz chromium_src-275cc06144eeb80f766bb62aac14fc4d3a85a01e.tar.bz2 |
Refactored to provide a new PortAllocatorFactory per PeerConnection.
This refactor MediaStreamDependencyFactory to create one PortAllocatorFactory per created PeerConnection. The reason is that the PortAllocator need a valid WebFrame that belongs to the
webpage that creates the PeerConnection. The valid WebFrame will be provided in a later cl from WebKit.
Roles libjingle to revision 195.
BUG=148366,150755
TEST= existing unit tests and https://apprtc.appspot.com/?r= between two tabs.
Review URL: https://chromiumcodereview.appspot.com/10977035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media/rtc_peer_connection_handler.cc')
-rw-r--r-- | content/renderer/media/rtc_peer_connection_handler.cc | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc index ba33ed7..a02dc51 100644 --- a/content/renderer/media/rtc_peer_connection_handler.cc +++ b/content/renderer/media/rtc_peer_connection_handler.cc @@ -19,6 +19,7 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCSessionDescriptionRequest.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCVoidRequest.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" // Converter functions from libjingle types to WebKit types. @@ -154,7 +155,21 @@ class RTCMediaConstraints : public webrtc::MediaConstraintsInterface { explicit RTCMediaConstraints( const WebKit::WebMediaConstraints& constraints) { } + virtual const Constraints& GetMandatory() const OVERRIDE { + // TODO(perkj): Implement. + NOTIMPLEMENTED(); + return mandatory_; + } + virtual const Constraints& GetOptional() const OVERRIDE { + // TODO(perkj): Implement. + NOTIMPLEMENTED(); + return optional_; + } ~RTCMediaConstraints() {} + + private: + Constraints mandatory_; + Constraints optional_; }; RTCPeerConnectionHandler::RTCPeerConnectionHandler( @@ -169,14 +184,40 @@ RTCPeerConnectionHandler::~RTCPeerConnectionHandler() { bool RTCPeerConnectionHandler::initialize( const WebKit::WebRTCConfiguration& server_configuration, - const WebKit::WebMediaConstraints& options ) { + const WebKit::WebMediaConstraints& options) { + webrtc::JsepInterface::IceServers servers; + GetNativeIceServers(server_configuration, &servers); + + // TODO(perkj) use a frame provided by WebKit to + // RTCPeerConnectionHandler::initialize when the new WebKit version has been + // rolled. + WebKit::WebFrame* frame = WebKit::WebFrame::frameForCurrentContext(); + if (!frame) { + LOG(ERROR) << "frame is NULL"; + return false; + } + + RTCMediaConstraints constraints(options); + native_peer_connection_ = + dependency_factory_->CreatePeerConnection( + servers, &constraints, frame, this); + if (!native_peer_connection_) { + LOG(ERROR) << "Failed to initialize native PeerConnection."; + return false; + } + return true; +} + +bool RTCPeerConnectionHandler::InitializeForTest( + const WebKit::WebRTCConfiguration& server_configuration, + const WebKit::WebMediaConstraints& options) { webrtc::JsepInterface::IceServers servers; GetNativeIceServers(server_configuration, &servers); RTCMediaConstraints constraints(options); native_peer_connection_ = dependency_factory_->CreatePeerConnection( - servers, &constraints, this); + servers, &constraints, NULL, this); if (!native_peer_connection_) { LOG(ERROR) << "Failed to initialize native PeerConnection."; return false; |