summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortommyw@chromium.org <tommyw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-06 10:50:54 +0000
committertommyw@chromium.org <tommyw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-06 10:50:54 +0000
commit2a222912b7843c96149256a8edcb4867c1339cff (patch)
tree4d81b87d81e9b5d9aad051359fc1efc9997975a7
parentafb14c2cc6095d515aa0754fb6e1e1c44db091b6 (diff)
downloadchromium_src-2a222912b7843c96149256a8edcb4867c1339cff.zip
chromium_src-2a222912b7843c96149256a8edcb4867c1339cff.tar.gz
chromium_src-2a222912b7843c96149256a8edcb4867c1339cff.tar.bz2
Removing support for PeerConnection00
This patch removes all relevant files from Chromium; no new functionality at all. BUG=159406 Review URL: https://chromiumcodereview.appspot.com/11293092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166187 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc1
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/content_tests.gypi3
-rw-r--r--content/public/common/content_switches.cc4
-rw-r--r--content/public/common/content_switches.h1
-rw-r--r--content/renderer/media/media_stream_center.cc54
-rw-r--r--content/renderer/media/media_stream_center.h6
-rw-r--r--content/renderer/media/media_stream_dependency_factory.cc15
-rw-r--r--content/renderer/media/media_stream_dependency_factory_unittest.cc10
-rw-r--r--content/renderer/media/mock_web_peer_connection_00_handler_client.cc56
-rw-r--r--content/renderer/media/mock_web_peer_connection_00_handler_client.h51
-rw-r--r--content/renderer/media/mock_web_rtc_peer_connection_handler_client.cc1
-rw-r--r--content/renderer/media/peer_connection_handler_jsep.cc370
-rw-r--r--content/renderer/media/peer_connection_handler_jsep.h84
-rw-r--r--content/renderer/media/peer_connection_handler_jsep_unittest.cc309
-rw-r--r--content/renderer/render_thread_impl.cc2
-rw-r--r--content/renderer/render_view_impl.cc4
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc18
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.h2
19 files changed, 0 insertions, 993 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index e2b1e88..efa3544 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -790,7 +790,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDomAutomationController,
switches::kEnableAccessibilityLogging,
switches::kEnableBrowserPluginForAllViewTypes,
- switches::kEnableDeprecatedPeerConnection,
switches::kEnableDCHECK,
switches::kEnableEncryptedMedia,
switches::kEnableExperimentalWebKitFeatures,
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 05def3b..269df95 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -329,8 +329,6 @@
'renderer/media/media_stream_impl.cc',
'renderer/media/peer_connection_handler_base.cc',
'renderer/media/peer_connection_handler_base.h',
- 'renderer/media/peer_connection_handler_jsep.cc',
- 'renderer/media/peer_connection_handler_jsep.h',
'renderer/media/rtc_peer_connection_handler.cc',
'renderer/media/rtc_peer_connection_handler.h',
'renderer/media/rtc_video_capture_delegate.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 881e3d4..8b208f0 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -183,8 +183,6 @@
'renderer/media/mock_media_stream_dispatcher.h',
'renderer/media/mock_peer_connection_impl.cc',
'renderer/media/mock_peer_connection_impl.h',
- 'renderer/media/mock_web_peer_connection_00_handler_client.cc',
- 'renderer/media/mock_web_peer_connection_00_handler_client.h',
'renderer/media/mock_web_rtc_peer_connection_handler_client.cc',
'renderer/media/mock_web_rtc_peer_connection_handler_client.h',
'test/webrtc_audio_device_test.cc',
@@ -514,7 +512,6 @@
'renderer/media/media_stream_dependency_factory_unittest.cc',
'renderer/media/media_stream_dispatcher_unittest.cc',
'renderer/media/media_stream_impl_unittest.cc',
- 'renderer/media/peer_connection_handler_jsep_unittest.cc',
'renderer/media/rtc_peer_connection_handler_unittest.cc',
'renderer/media/rtc_video_decoder_unittest.cc',
'renderer/media/webrtc_audio_device_unittest.cc',
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 9dbb416..5559883 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -302,10 +302,6 @@ const char kDisableMediaSource[] = "disable-media-source";
// media stream.
const char kDisableWebMediaPlayerMS[] = "disable-web-media-player-ms";
-// Enables the deprecated PeerConnection functionality.
-const char kEnableDeprecatedPeerConnection[] =
- "enable-deprecated-peer-connection";
-
// Use fake device for MediaStream to replace actual camera and microphone.
const char kUseFakeDeviceForMediaStream[] = "use-fake-device-for-media-stream";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index f165206..e9c9352 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -106,7 +106,6 @@ extern const char kEnableGpuBenchmarking[];
CONTENT_EXPORT extern const char kEnableLogging[];
extern const char kDisableMediaSource[];
extern const char kDisableWebMediaPlayerMS[];
-extern const char kEnableDeprecatedPeerConnection[];
CONTENT_EXPORT extern const char kUseFakeDeviceForMediaStream[];
extern const char kEnableMonitorProfile[];
extern const char kEnableUIReleaseFrontSurface[];
diff --git a/content/renderer/media/media_stream_center.cc b/content/renderer/media/media_stream_center.cc
index c6c0076..8bd44f5 100644
--- a/content/renderer/media/media_stream_center.cc
+++ b/content/renderer/media/media_stream_center.cc
@@ -15,13 +15,11 @@
#include "content/renderer/media/media_stream_impl.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/libjingle/source/talk/app/webrtc/jsep.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
@@ -124,56 +122,4 @@ void MediaStreamCenter::didCreateMediaStream(
rtc_factory_->CreateNativeLocalMediaStream(&stream);
}
-WebKit::WebString MediaStreamCenter::constructSDP(
- const WebKit::WebICECandidateDescriptor& candidate) {
- int m_line_index = -1;
- if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) {
- LOG(ERROR) << "Invalid candidate label: " << UTF16ToUTF8(candidate.label());
- return WebKit::WebString();
- }
- // TODO(ronghuawu): Get sdp_mid from WebKit when is available.
- const std::string sdp_mid;
- scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
- webrtc::CreateIceCandidate(sdp_mid,
- m_line_index,
- UTF16ToUTF8(candidate.candidateLine())));
- std::string sdp;
- if (!native_candidate->ToString(&sdp))
- LOG(ERROR) << "Could not create SDP string";
- return UTF8ToUTF16(sdp);
-}
-
-WebKit::WebString MediaStreamCenter::constructSDP(
- const WebKit::WebSessionDescriptionDescriptor& description) {
- scoped_ptr<webrtc::SessionDescriptionInterface> native_desc(
- webrtc::CreateSessionDescription(UTF16ToUTF8(description.initialSDP())));
- if (!native_desc.get())
- return WebKit::WebString();
-
- for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) {
- WebKit::WebICECandidateDescriptor candidate = description.candidate(i);
- int m_line_index = -1;
- if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) {
- LOG(ERROR) << "Invalid candidate label: "
- << UTF16ToUTF8(candidate.label());
- continue;
- }
- // TODO(ronghuawu): Get sdp_mid from WebKit when is available.
- const std::string sdp_mid;
- scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
- webrtc::CreateIceCandidate(sdp_mid,
- m_line_index,
- UTF16ToUTF8(candidate.candidateLine())));
- if (!native_desc->AddCandidate(native_candidate.get())) {
- LOG(ERROR) << "Failed to add candidate to SessionDescription.";
- continue;
- }
- }
-
- std::string sdp;
- if (!native_desc->ToString(&sdp))
- LOG(ERROR) << "Could not create SDP string";
- return UTF8ToUTF16(sdp);
-}
-
} // namespace content
diff --git a/content/renderer/media/media_stream_center.h b/content/renderer/media/media_stream_center.h
index 95ce850..285d901 100644
--- a/content/renderer/media/media_stream_center.h
+++ b/content/renderer/media/media_stream_center.h
@@ -40,12 +40,6 @@ class CONTENT_EXPORT MediaStreamCenter
virtual void didCreateMediaStream(
WebKit::WebMediaStreamDescriptor& stream) OVERRIDE;
- virtual WebKit::WebString constructSDP(
- const WebKit::WebICECandidateDescriptor& candidate) OVERRIDE;
-
- virtual WebKit::WebString constructSDP(
- const WebKit::WebSessionDescriptionDescriptor& description) OVERRIDE;
-
private:
// |rtc_factory_| is a weak pointer and is owned by the RenderThreadImpl.
// It is valid as long as RenderThreadImpl exist.
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index 26d76a5..be442d4 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -9,7 +9,6 @@
#include "base/synchronization/waitable_event.h"
#include "base/utf_string_conversions.h"
#include "content/renderer/media/media_stream_source_extra_data.h"
-#include "content/renderer/media/peer_connection_handler_jsep.h"
#include "content/renderer/media/rtc_media_constraints.h"
#include "content/renderer/media/rtc_peer_connection_handler.h"
#include "content/renderer/media/rtc_video_capturer.h"
@@ -172,20 +171,6 @@ MediaStreamDependencyFactory::~MediaStreamDependencyFactory() {
CleanupPeerConnectionFactory();
}
-WebKit::WebPeerConnection00Handler*
-MediaStreamDependencyFactory::CreatePeerConnectionHandlerJsep(
- WebKit::WebPeerConnection00HandlerClient* client) {
- // Save histogram data so we can see how much PeerConnetion is used.
- // The histogram counts the number of calls to the JS API
- // webKitPeerConnection00.
- UpdateWebRTCMethodCount(WEBKIT_PEER_CONNECTION);
-
- if (!EnsurePeerConnectionFactory())
- return NULL;
-
- return new PeerConnectionHandlerJsep(client, this);
-}
-
WebKit::WebRTCPeerConnectionHandler*
MediaStreamDependencyFactory::CreateRTCPeerConnectionHandler(
WebKit::WebRTCPeerConnectionHandlerClient* client) {
diff --git a/content/renderer/media/media_stream_dependency_factory_unittest.cc b/content/renderer/media/media_stream_dependency_factory_unittest.cc
index 4793ee0..8c97bd9 100644
--- a/content/renderer/media/media_stream_dependency_factory_unittest.cc
+++ b/content/renderer/media/media_stream_dependency_factory_unittest.cc
@@ -7,7 +7,6 @@
#include "content/renderer/media/media_stream_extra_data.h"
#include "content/renderer/media/media_stream_source_extra_data.h"
#include "content/renderer/media/mock_media_stream_dependency_factory.h"
-#include "content/renderer/media/mock_web_peer_connection_00_handler_client.h"
#include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
@@ -15,8 +14,6 @@
#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamComponent.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamDescriptor.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSource.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebPeerConnection00Handler.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebPeerConnectionHandler.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
@@ -111,13 +108,6 @@ class MediaStreamDependencyFactoryTest : public ::testing::Test {
scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_;
};
-TEST_F(MediaStreamDependencyFactoryTest, CreatePeerConnectionHandlerJsep) {
- MockWebPeerConnection00HandlerClient client_jsep;
- scoped_ptr<WebKit::WebPeerConnection00Handler> pc_handler_jsep(
- dependency_factory_->CreatePeerConnectionHandlerJsep(&client_jsep));
- EXPECT_TRUE(pc_handler_jsep.get() != NULL);
-}
-
TEST_F(MediaStreamDependencyFactoryTest, CreateRTCPeerConnectionHandler) {
MockWebRTCPeerConnectionHandlerClient client_jsep;
scoped_ptr<WebKit::WebRTCPeerConnectionHandler> pc_handler(
diff --git a/content/renderer/media/mock_web_peer_connection_00_handler_client.cc b/content/renderer/media/mock_web_peer_connection_00_handler_client.cc
deleted file mode 100644
index 513995c..0000000
--- a/content/renderer/media/mock_web_peer_connection_00_handler_client.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/logging.h"
-#include "base/utf_string_conversions.h"
-#include "content/renderer/media/mock_web_peer_connection_00_handler_client.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
-
-namespace content {
-
-MockWebPeerConnection00HandlerClient::
-MockWebPeerConnection00HandlerClient()
- : ready_state_(ReadyStateNew),
- more_to_follow_(false) {
-}
-
-MockWebPeerConnection00HandlerClient::
-~MockWebPeerConnection00HandlerClient() {}
-
-void MockWebPeerConnection00HandlerClient::didGenerateICECandidate(
- const WebKit::WebICECandidateDescriptor& candidate,
- bool more_to_follow) {
- if (candidate.isNull()) {
- candidate_label_.clear();
- candidate_sdp_.clear();
- } else {
- candidate_label_ = UTF16ToUTF8(candidate.label());
- candidate_sdp_ = UTF16ToUTF8(candidate.candidateLine());
- }
- more_to_follow_ = more_to_follow;
-}
-
-void MockWebPeerConnection00HandlerClient::didChangeReadyState(
- ReadyState state) {
- ready_state_ = state;
-}
-
-void MockWebPeerConnection00HandlerClient::didChangeICEState(ICEState state) {
- NOTIMPLEMENTED();
-}
-
-void MockWebPeerConnection00HandlerClient::didAddRemoteStream(
- const WebKit::WebMediaStreamDescriptor& stream_descriptor) {
- stream_label_ = UTF16ToUTF8(stream_descriptor.label());
-}
-
-void MockWebPeerConnection00HandlerClient::didRemoveRemoteStream(
- const WebKit::WebMediaStreamDescriptor& stream_descriptor) {
- DCHECK(stream_label_ == UTF16ToUTF8(stream_descriptor.label()));
- stream_label_.clear();
-}
-
-} // namespace content
diff --git a/content/renderer/media/mock_web_peer_connection_00_handler_client.h b/content/renderer/media/mock_web_peer_connection_00_handler_client.h
deleted file mode 100644
index 5fa3536..0000000
--- a/content/renderer/media/mock_web_peer_connection_00_handler_client.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_RENDERER_MEDIA_MOCK_WEB_JSEP_PEER_CONNECTION_HANDLER_CLIENT_H_
-#define CONTENT_RENDERER_MEDIA_MOCK_WEB_JSEP_PEER_CONNECTION_HANDLER_CLIENT_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h"
-
-namespace content {
-
-class MockWebPeerConnection00HandlerClient
- : public WebKit::WebPeerConnection00HandlerClient {
- public:
- MockWebPeerConnection00HandlerClient();
- virtual ~MockWebPeerConnection00HandlerClient();
-
- // WebPeerConnection00HandlerClient implementation.
- virtual void didGenerateICECandidate(
- const WebKit::WebICECandidateDescriptor& candidate,
- bool more_to_follow) OVERRIDE;
- virtual void didChangeReadyState(ReadyState state) OVERRIDE;
- virtual void didChangeICEState(ICEState state) OVERRIDE;
- virtual void didAddRemoteStream(
- const WebKit::WebMediaStreamDescriptor& stream_descriptor) OVERRIDE;
- virtual void didRemoveRemoteStream(
- const WebKit::WebMediaStreamDescriptor& stream_descriptor) OVERRIDE;
-
- const std::string& stream_label() const { return stream_label_; }
- ReadyState ready_state() const { return ready_state_; }
- const std::string& candidate_label() const { return candidate_label_; }
- const std::string& candidate_sdp() const { return candidate_sdp_; }
- bool more_to_follow() const { return more_to_follow_; }
-
- private:
- std::string stream_label_;
- ReadyState ready_state_;
- std::string candidate_label_;
- std::string candidate_sdp_;
- bool more_to_follow_;
-
- DISALLOW_COPY_AND_ASSIGN(MockWebPeerConnection00HandlerClient);
-};
-
-} // namespace content
-
-#endif // CONTENT_RENDERER_MEDIA_MOCK_WEB_JSEP_PEER_CONNECTION_HANDLER_CLIENT_H_
diff --git a/content/renderer/media/mock_web_rtc_peer_connection_handler_client.cc b/content/renderer/media/mock_web_rtc_peer_connection_handler_client.cc
index 685cb86..4c7c19d 100644
--- a/content/renderer/media/mock_web_rtc_peer_connection_handler_client.cc
+++ b/content/renderer/media/mock_web_rtc_peer_connection_handler_client.cc
@@ -5,7 +5,6 @@
#include "base/logging.h"
#include "base/utf_string_conversions.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
diff --git a/content/renderer/media/peer_connection_handler_jsep.cc b/content/renderer/media/peer_connection_handler_jsep.cc
deleted file mode 100644
index 5601b898..0000000
--- a/content/renderer/media/peer_connection_handler_jsep.cc
+++ /dev/null
@@ -1,370 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/media/peer_connection_handler_jsep.h"
-
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/string_number_conversions.h"
-#include "base/stringprintf.h"
-#include "base/utf_string_conversions.h"
-#include "content/renderer/media/media_stream_dependency_factory.h"
-#include "content/renderer/media/media_stream_impl.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICEOptions.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaHints.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
-
-namespace content {
-
-PeerConnectionHandlerJsep::PeerConnectionHandlerJsep(
- WebKit::WebPeerConnection00HandlerClient* client,
- MediaStreamDependencyFactory* dependency_factory)
- : PeerConnectionHandlerBase(dependency_factory),
- client_(client) {
-}
-
-PeerConnectionHandlerJsep::~PeerConnectionHandlerJsep() {
-}
-
-void PeerConnectionHandlerJsep::initialize(
- const WebKit::WebString& server_configuration,
- const WebKit::WebString& username) {
- native_peer_connection_ = dependency_factory_->CreatePeerConnection(
- UTF16ToUTF8(server_configuration),
- this);
- CHECK(native_peer_connection_);
-}
-
-WebKit::WebSessionDescriptionDescriptor PeerConnectionHandlerJsep::createOffer(
- const WebKit::WebMediaHints& hints) {
- WebKit::WebSessionDescriptionDescriptor offer;
-
- webrtc::MediaHints native_hints(hints.audio(), hints.video());
- scoped_ptr<webrtc::SessionDescriptionInterface> native_offer(
- native_peer_connection_->CreateOffer(native_hints));
- if (!native_offer.get()) {
- LOG(ERROR) << "Failed to create native offer";
- return offer;
- }
-
- offer = CreateWebKitSessionDescription(native_offer.get());
- return offer;
-}
-
-WebKit::WebSessionDescriptionDescriptor PeerConnectionHandlerJsep::createAnswer(
- const WebKit::WebString& offer,
- const WebKit::WebMediaHints& hints) {
- WebKit::WebSessionDescriptionDescriptor answer;
-
- webrtc::MediaHints native_hints(hints.audio(), hints.video());
- scoped_ptr<webrtc::SessionDescriptionInterface> native_offer(
- dependency_factory_->CreateSessionDescription(UTF16ToUTF8(offer)));
- if (!native_offer.get()) {
- LOG(ERROR) << "Failed to create native offer";
- return answer;
- }
-
- scoped_ptr<webrtc::SessionDescriptionInterface> native_answer(
- native_peer_connection_->CreateAnswer(native_hints, native_offer.get()));
- if (!native_answer.get()) {
- LOG(ERROR) << "Failed to create native answer";
- return answer;
- }
-
- answer = CreateWebKitSessionDescription(native_answer.get());
- return answer;
-}
-
-bool PeerConnectionHandlerJsep::setLocalDescription(
- Action action,
- const WebKit::WebSessionDescriptionDescriptor& description) {
- webrtc::PeerConnectionInterface::Action native_action;
- if (!GetNativeAction(action, &native_action))
- return false;
-
- webrtc::SessionDescriptionInterface* native_desc =
- CreateNativeSessionDescription(description);
- if (!native_desc)
- return false;
-
- return native_peer_connection_->SetLocalDescription(native_action,
- native_desc);
-}
-
-bool PeerConnectionHandlerJsep::setRemoteDescription(
- Action action,
- const WebKit::WebSessionDescriptionDescriptor& description) {
- webrtc::PeerConnectionInterface::Action native_action;
- if (!GetNativeAction(action, &native_action))
- return false;
-
- webrtc::SessionDescriptionInterface* native_desc =
- CreateNativeSessionDescription(description);
- if (!native_desc)
- return false;
-
- return native_peer_connection_->SetRemoteDescription(native_action,
- native_desc);
-}
-
-WebKit::WebSessionDescriptionDescriptor
-PeerConnectionHandlerJsep::localDescription() {
- const webrtc::SessionDescriptionInterface* native_desc =
- native_peer_connection_->local_description();
- WebKit::WebSessionDescriptionDescriptor description =
- CreateWebKitSessionDescription(native_desc);
- return description;
-}
-
-WebKit::WebSessionDescriptionDescriptor
-PeerConnectionHandlerJsep::remoteDescription() {
- const webrtc::SessionDescriptionInterface* native_desc =
- native_peer_connection_->remote_description();
- WebKit::WebSessionDescriptionDescriptor description =
- CreateWebKitSessionDescription(native_desc);
- return description;
-}
-
-bool PeerConnectionHandlerJsep::startIce(const WebKit::WebICEOptions& options) {
- webrtc::PeerConnectionInterface::IceOptions native_options;
- switch (options.candidateTypeToUse()) {
- case WebKit::WebICEOptions::CandidateTypeAll:
- native_options = webrtc::PeerConnectionInterface::kUseAll;
- break;
- case WebKit::WebICEOptions::CandidateTypeNoRelay:
- native_options = webrtc::PeerConnectionInterface::kNoRelay;
- break;
- case WebKit::WebICEOptions::CandidateTypeOnlyRelay:
- native_options = webrtc::PeerConnectionInterface::kOnlyRelay;
- break;
- default:
- NOTREACHED();
- return false;
- }
- native_peer_connection_->StartIce(native_options);
- return true;
-}
-
-bool PeerConnectionHandlerJsep::processIceMessage(
- const WebKit::WebICECandidateDescriptor& candidate) {
- int m_line_index = -1;
- if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) {
- LOG(ERROR) << "Invalid candidate label: "
- << UTF16ToUTF8(candidate.label());
- return false;
- }
- // TODO(ronghuawu): Use sdp_mid when its available, for now its empty string.
- const std::string sdp_mid = "";
- scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
- dependency_factory_->CreateIceCandidate(
- sdp_mid,
- m_line_index,
- UTF16ToUTF8(candidate.candidateLine())));
- if (!native_candidate.get()) {
- LOG(ERROR) << "Could not create native ICE candidate";
- return false;
- }
-
- bool return_value =
- native_peer_connection_->ProcessIceMessage(native_candidate.get());
- if (!return_value)
- LOG(ERROR) << "Error processing ICE message";
- return return_value;
-}
-
-void PeerConnectionHandlerJsep::addStream(
- const WebKit::WebMediaStreamDescriptor& stream) {
- AddStream(stream);
-}
-
-void PeerConnectionHandlerJsep::removeStream(
- const WebKit::WebMediaStreamDescriptor& stream) {
- RemoveStream(stream);
-}
-
-void PeerConnectionHandlerJsep::stop() {
- DVLOG(1) << "PeerConnectionHandlerJsep::stop";
- native_peer_connection_ = NULL;
-}
-
-void PeerConnectionHandlerJsep::OnError() {
- // TODO(grunell): Implement.
- NOTIMPLEMENTED();
-}
-
-void PeerConnectionHandlerJsep::OnStateChange(StateType state_changed) {
- switch (state_changed) {
- case kReadyState:
- WebKit::WebPeerConnection00HandlerClient::ReadyState ready_state;
- switch (native_peer_connection_->ready_state()) {
- case webrtc::PeerConnectionInterface::kNew:
- ready_state = WebKit::WebPeerConnection00HandlerClient::ReadyStateNew;
- break;
- case webrtc::PeerConnectionInterface::kOpening:
- ready_state =
- WebKit::WebPeerConnection00HandlerClient::ReadyStateNegotiating;
- break;
- case webrtc::PeerConnectionInterface::kActive:
- ready_state =
- WebKit::WebPeerConnection00HandlerClient::ReadyStateActive;
- break;
- case webrtc::PeerConnectionInterface::kClosing:
- // Not used by JSEP.
- NOTREACHED();
- return;
- case webrtc::PeerConnectionInterface::kClosed:
- ready_state =
- WebKit::WebPeerConnection00HandlerClient::ReadyStateClosed;
- break;
- default:
- NOTREACHED();
- return;
- }
- client_->didChangeReadyState(ready_state);
- break;
- case kIceState:
- // TODO(grunell): Implement when available in native PeerConnection.
- NOTIMPLEMENTED();
- break;
- default:
- NOTREACHED();
- break;
- }
-}
-
-void PeerConnectionHandlerJsep::OnAddStream(
- webrtc::MediaStreamInterface* stream) {
- if (!stream)
- return;
-
- DCHECK(remote_streams_.find(stream) == remote_streams_.end());
- WebKit::WebMediaStreamDescriptor descriptor =
- CreateWebKitStreamDescriptor(stream);
- remote_streams_.insert(
- std::pair<webrtc::MediaStreamInterface*,
- WebKit::WebMediaStreamDescriptor>(stream, descriptor));
- client_->didAddRemoteStream(descriptor);
-}
-
-void PeerConnectionHandlerJsep::OnRemoveStream(
- webrtc::MediaStreamInterface* stream) {
- if (!stream)
- return;
-
- RemoteStreamMap::iterator it = remote_streams_.find(stream);
- if (it == remote_streams_.end()) {
- NOTREACHED() << "Stream not found";
- return;
- }
- WebKit::WebMediaStreamDescriptor descriptor = it->second;
- DCHECK(!descriptor.isNull());
- remote_streams_.erase(it);
- client_->didRemoveRemoteStream(descriptor);
-}
-
-void PeerConnectionHandlerJsep::OnIceCandidate(
- const webrtc::IceCandidateInterface* candidate) {
- WebKit::WebICECandidateDescriptor web_candidate;
-
- std::string label = StringPrintf("%d", candidate->sdp_mline_index());
- std::string sdp;
- if (!candidate->ToString(&sdp)) {
- LOG(ERROR) << "Could not get SDP string";
- return;
- }
-
- web_candidate.initialize(UTF8ToUTF16(label), UTF8ToUTF16(sdp));
-
- // moreToFollow parameter isn't supported in native PeerConnection, so we
- // always use true here, and then false in OnIceComplete().
- client_->didGenerateICECandidate(web_candidate, true);
-}
-
-void PeerConnectionHandlerJsep::OnIceComplete() {
- // moreToFollow parameter isn't supported in native PeerConnection, so we
- // send an empty WebIseCandidate with moreToFollow=false.
- WebKit::WebICECandidateDescriptor web_candidate;
- client_->didGenerateICECandidate(web_candidate, false);
-}
-
-webrtc::SessionDescriptionInterface*
-PeerConnectionHandlerJsep::CreateNativeSessionDescription(
- const WebKit::WebSessionDescriptionDescriptor& description) {
- std::string initial_sdp = UTF16ToUTF8(description.initialSDP());
- webrtc::SessionDescriptionInterface* native_desc =
- dependency_factory_->CreateSessionDescription(initial_sdp);
- if (!native_desc) {
- LOG(ERROR) << "Failed to create native session description";
- return NULL;
- }
- // TODO(ronghuawu): Apply sdp_mid when its available, now its empty string.
- const std::string sdp_mid = "";
- for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) {
- WebKit::WebICECandidateDescriptor candidate = description.candidate(i);
- int m_line_index = -1;
- if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) {
- LOG(ERROR) << "Invalid candidate label: "
- << UTF16ToUTF8(candidate.label());
- continue;
- }
- scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
- dependency_factory_->CreateIceCandidate(
- sdp_mid,
- m_line_index,
- UTF16ToUTF8(candidate.candidateLine())));
- if (!native_desc->AddCandidate(native_candidate.get()))
- LOG(ERROR) << "Failed to add candidate to native session description";
- }
-
- return native_desc;
-}
-
-WebKit::WebSessionDescriptionDescriptor
-PeerConnectionHandlerJsep::CreateWebKitSessionDescription(
- const webrtc::SessionDescriptionInterface* native_desc) {
- WebKit::WebSessionDescriptionDescriptor description;
- if (!native_desc) {
- VLOG(1) << "Native session description is null";
- return description;
- }
-
- std::string sdp;
- if (!native_desc->ToString(&sdp)) {
- LOG(ERROR) << "Failed to get SDP string of native session description";
- return description;
- }
-
- description.initialize(UTF8ToUTF16(sdp));
- return description;
-}
-
-bool PeerConnectionHandlerJsep::GetNativeAction(
- const Action action,
- webrtc::PeerConnectionInterface::Action* native_action) {
- switch (action) {
- case ActionSDPOffer:
- *native_action = webrtc::PeerConnectionInterface::kOffer;
- break;
- case ActionSDPPRanswer:
- *native_action = webrtc::PeerConnectionInterface::kPrAnswer;
- break;
- case ActionSDPAnswer:
- *native_action = webrtc::PeerConnectionInterface::kAnswer;
- break;
- default:
- NOTREACHED();
- return false;
- }
- return true;
-}
-
-} // namespace content
diff --git a/content/renderer/media/peer_connection_handler_jsep.h b/content/renderer/media/peer_connection_handler_jsep.h
deleted file mode 100644
index 6eb6e25..0000000
--- a/content/renderer/media/peer_connection_handler_jsep.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_JSEP_H_
-#define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_JSEP_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/gtest_prod_util.h"
-#include "content/common/content_export.h"
-#include "content/renderer/media/peer_connection_handler_base.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h"
-
-namespace content {
-
-// PeerConnectionHandlerJsep is a delegate for the JSEP PeerConnection API
-// messages going between WebKit and native PeerConnection in libjingle. It's
-// owned by WebKit.
-class CONTENT_EXPORT PeerConnectionHandlerJsep
- : public PeerConnectionHandlerBase,
- NON_EXPORTED_BASE(public WebKit::WebPeerConnection00Handler) {
- public:
- PeerConnectionHandlerJsep(
- WebKit::WebPeerConnection00HandlerClient* client,
- MediaStreamDependencyFactory* dependency_factory);
- virtual ~PeerConnectionHandlerJsep();
-
- // WebKit::WebPeerConnection00Handler implementation
- virtual void initialize(
- const WebKit::WebString& server_configuration,
- const WebKit::WebString& username) OVERRIDE;
- virtual WebKit::WebSessionDescriptionDescriptor createOffer(
- const WebKit::WebMediaHints& hints) OVERRIDE;
- virtual WebKit::WebSessionDescriptionDescriptor createAnswer(
- const WebKit::WebString& offer,
- const WebKit::WebMediaHints& hints) OVERRIDE;
- virtual bool setLocalDescription(
- Action action,
- const WebKit::WebSessionDescriptionDescriptor& description) OVERRIDE;
- virtual bool setRemoteDescription(
- Action action,
- const WebKit::WebSessionDescriptionDescriptor& description) OVERRIDE;
- virtual WebKit::WebSessionDescriptionDescriptor localDescription() OVERRIDE;
- virtual WebKit::WebSessionDescriptionDescriptor remoteDescription() OVERRIDE;
- virtual bool startIce(const WebKit::WebICEOptions& options) OVERRIDE;
- virtual bool processIceMessage(
- const WebKit::WebICECandidateDescriptor& candidate) OVERRIDE;
- virtual void addStream(
- const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE;
- virtual void removeStream(
- const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE;
- // We will be deleted by WebKit after stop has been returned.
- virtual void stop() OVERRIDE;
-
- // webrtc::PeerConnectionObserver implementation
- virtual void OnError() OVERRIDE;
- virtual void OnStateChange(StateType state_changed) OVERRIDE;
- virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE;
- virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE;
- virtual void OnIceCandidate(
- const webrtc::IceCandidateInterface* candidate) OVERRIDE;
- virtual void OnIceComplete() OVERRIDE;
-
- private:
- webrtc::SessionDescriptionInterface* CreateNativeSessionDescription(
- const WebKit::WebSessionDescriptionDescriptor& description);
- WebKit::WebSessionDescriptionDescriptor CreateWebKitSessionDescription(
- const webrtc::SessionDescriptionInterface* native_desc);
- bool GetNativeAction(
- const Action action,
- webrtc::PeerConnectionInterface::Action* native_action);
-
- // client_ is a weak pointer, and is valid until stop() has returned.
- WebKit::WebPeerConnection00HandlerClient* client_;
-
- DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandlerJsep);
-};
-
-} // namespace content
-
-#endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_JSEP_H_
diff --git a/content/renderer/media/peer_connection_handler_jsep_unittest.cc b/content/renderer/media/peer_connection_handler_jsep_unittest.cc
deleted file mode 100644
index 483d031..0000000
--- a/content/renderer/media/peer_connection_handler_jsep_unittest.cc
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <string>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/utf_string_conversions.h"
-#include "content/renderer/media/media_stream_extra_data.h"
-#include "content/renderer/media/mock_media_stream_dependency_factory.h"
-#include "content/renderer/media/mock_web_peer_connection_00_handler_client.h"
-#include "content/renderer/media/mock_peer_connection_impl.h"
-#include "content/renderer/media/peer_connection_handler_jsep.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICEOptions.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaHints.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
-
-namespace content {
-
-class PeerConnectionHandlerJsepUnderTest : public PeerConnectionHandlerJsep {
- public:
- PeerConnectionHandlerJsepUnderTest(
- WebKit::WebPeerConnection00HandlerClient* client,
- MediaStreamDependencyFactory* dependency_factory)
- : PeerConnectionHandlerJsep(client, dependency_factory) {
- }
-
- MockPeerConnectionImpl* native_peer_connection() {
- return static_cast<MockPeerConnectionImpl*>(native_peer_connection_.get());
- }
-};
-
-class PeerConnectionHandlerJsepTest : public ::testing::Test {
- public:
- PeerConnectionHandlerJsepTest() : mock_peer_connection_(NULL) {
- }
-
- void SetUp() {
- mock_client_.reset(new MockWebPeerConnection00HandlerClient());
- mock_dependency_factory_.reset(
- new MockMediaStreamDependencyFactory());
- mock_dependency_factory_->EnsurePeerConnectionFactory();
- pc_handler_.reset(
- new PeerConnectionHandlerJsepUnderTest(mock_client_.get(),
- mock_dependency_factory_.get()));
-
- WebKit::WebString server_config(
- WebKit::WebString::fromUTF8("STUN stun.l.google.com:19302"));
- WebKit::WebString username;
- pc_handler_->initialize(server_config, username);
-
- mock_peer_connection_ = pc_handler_->native_peer_connection();
- ASSERT_TRUE(mock_peer_connection_);
- }
-
- // Creates a WebKit local MediaStream.
- WebKit::WebMediaStreamDescriptor CreateLocalMediaStream(
- const std::string& stream_label) {
- std::string video_track_label("video-label");
- std::string audio_track_label("audio-label");
-
- talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> native_stream(
- mock_dependency_factory_->CreateLocalMediaStream(stream_label));
- talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> audio_track(
- mock_dependency_factory_->CreateLocalAudioTrack(audio_track_label,
- NULL));
- native_stream->AddTrack(audio_track);
- talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> video_track(
- mock_dependency_factory_->CreateLocalVideoTrack(
- video_track_label, 0));
- native_stream->AddTrack(video_track);
-
- WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources(
- static_cast<size_t>(1));
- audio_sources[0].initialize(WebKit::WebString::fromUTF8(video_track_label),
- WebKit::WebMediaStreamSource::TypeAudio,
- WebKit::WebString::fromUTF8("audio_track"));
- WebKit::WebVector<WebKit::WebMediaStreamSource> video_sources(
- static_cast<size_t>(1));
- video_sources[0].initialize(WebKit::WebString::fromUTF8(video_track_label),
- WebKit::WebMediaStreamSource::TypeVideo,
- WebKit::WebString::fromUTF8("video_track"));
- WebKit::WebMediaStreamDescriptor local_stream;
- local_stream.initialize(UTF8ToUTF16(stream_label), audio_sources,
- video_sources);
- local_stream.setExtraData(new MediaStreamExtraData(native_stream));
- return local_stream;
- }
-
- // Creates a remote MediaStream and adds it to the mocked native
- // peer connection.
- talk_base::scoped_refptr<webrtc::MediaStreamInterface>
- AddRemoteMockMediaStream(const std::string& stream_label,
- const std::string& video_track_label,
- const std::string& audio_track_label) {
- // We use a local stream as a remote since for testing purposes we really
- // only need the MediaStreamInterface.
- talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream(
- mock_dependency_factory_->CreateLocalMediaStream(stream_label));
- if (!video_track_label.empty()) {
- talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> video_track(
- mock_dependency_factory_->CreateLocalVideoTrack(
- video_track_label, 0));
- stream->AddTrack(video_track);
- }
- if (!audio_track_label.empty()) {
- talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> audio_track(
- mock_dependency_factory_->CreateLocalAudioTrack(audio_track_label,
- NULL));
- stream->AddTrack(audio_track);
- }
- mock_peer_connection_->AddRemoteStream(stream);
- return stream;
- }
-
- scoped_ptr<MockWebPeerConnection00HandlerClient> mock_client_;
- scoped_ptr<MockMediaStreamDependencyFactory> mock_dependency_factory_;
- scoped_ptr<PeerConnectionHandlerJsepUnderTest> pc_handler_;
-
- // Weak reference to the mocked native peer connection implementation.
- MockPeerConnectionImpl* mock_peer_connection_;
-};
-
-TEST_F(PeerConnectionHandlerJsepTest, Basic) {
- // Create offer.
- WebKit::WebMediaHints hints;
- hints.initialize(true, true);
- WebKit::WebSessionDescriptionDescriptor offer =
- pc_handler_->createOffer(hints);
- EXPECT_FALSE(offer.isNull());
- EXPECT_EQ(std::string(mock_peer_connection_->kDummyOffer),
- UTF16ToUTF8(offer.initialSDP()));
- EXPECT_EQ(hints.audio(), mock_peer_connection_->hint_audio());
- EXPECT_EQ(hints.video(), mock_peer_connection_->hint_video());
-
- // Create answer.
- WebKit::WebString offer_string = "offer";
- hints.reset();
- hints.initialize(false, false);
- WebKit::WebSessionDescriptionDescriptor answer =
- pc_handler_->createAnswer(offer_string, hints);
- EXPECT_FALSE(answer.isNull());
- EXPECT_EQ(UTF16ToUTF8(offer_string), UTF16ToUTF8(answer.initialSDP()));
- EXPECT_EQ(UTF16ToUTF8(offer_string),
- mock_peer_connection_->description_sdp());
- EXPECT_EQ(hints.audio(), mock_peer_connection_->hint_audio());
- EXPECT_EQ(hints.video(), mock_peer_connection_->hint_video());
-
- // Set local description.
- PeerConnectionHandlerJsep::Action action =
- PeerConnectionHandlerJsep::ActionSDPOffer;
- WebKit::WebSessionDescriptionDescriptor description;
- WebKit::WebString sdp = "test sdp";
- description.initialize(sdp);
- EXPECT_TRUE(pc_handler_->setLocalDescription(action, description));
- EXPECT_EQ(webrtc::PeerConnectionInterface::kOffer,
- mock_peer_connection_->action());
- EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->description_sdp());
-
- // Get local description.
- description.reset();
- description = pc_handler_->localDescription();
- EXPECT_FALSE(description.isNull());
- EXPECT_EQ(UTF16ToUTF8(sdp), UTF16ToUTF8(description.initialSDP()));
-
- // Set remote description.
- sdp = "test sdp 2";
- description.reset();
- description.initialize(sdp);
-
- // PrAnswer
- action = PeerConnectionHandlerJsep::ActionSDPPRanswer;
- EXPECT_TRUE(pc_handler_->setRemoteDescription(action, description));
- EXPECT_EQ(webrtc::PeerConnectionInterface::kPrAnswer,
- mock_peer_connection_->action());
- EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->description_sdp());
- // Get remote description.
- description.reset();
- description = pc_handler_->remoteDescription();
- EXPECT_FALSE(description.isNull());
- EXPECT_EQ(UTF16ToUTF8(sdp), UTF16ToUTF8(description.initialSDP()));
-
- // Answer
- action = PeerConnectionHandlerJsep::ActionSDPAnswer;
- EXPECT_TRUE(pc_handler_->setRemoteDescription(action, description));
- EXPECT_EQ(webrtc::PeerConnectionInterface::kAnswer,
- mock_peer_connection_->action());
- EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->description_sdp());
-
- // Get remote description.
- description.reset();
- description = pc_handler_->remoteDescription();
- EXPECT_FALSE(description.isNull());
- EXPECT_EQ(UTF16ToUTF8(sdp), UTF16ToUTF8(description.initialSDP()));
-
- // Start ICE.
- WebKit::WebICEOptions options;
- options.initialize(WebKit::WebICEOptions::CandidateTypeAll);
- EXPECT_TRUE(pc_handler_->startIce(options));
- EXPECT_EQ(webrtc::PeerConnectionInterface::kUseAll,
- mock_peer_connection_->ice_options());
-
- // Process ICE message.
- WebKit::WebICECandidateDescriptor candidate;
- WebKit::WebString label = "0";
- sdp = "test sdp";
- candidate.initialize(label, sdp);
- EXPECT_TRUE(pc_handler_->processIceMessage(candidate));
- EXPECT_EQ(0, mock_peer_connection_->sdp_mline_index());
- EXPECT_TRUE(mock_peer_connection_->sdp_mid().empty());
- EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp());
-
- // Add stream.
- std::string stream_label = "local_stream";
- WebKit::WebMediaStreamDescriptor local_stream(
- CreateLocalMediaStream(stream_label));
-
- pc_handler_->addStream(local_stream);
- EXPECT_EQ(stream_label, mock_peer_connection_->stream_label());
-
- // On add stream. ( Remote stream received)
- std::string remote_stream_label("remote_stream");
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> remote_stream(
- AddRemoteMockMediaStream(remote_stream_label, "video", "audio"));
- pc_handler_->OnAddStream(remote_stream);
- EXPECT_EQ(remote_stream_label, mock_client_->stream_label());
-
- // Remove stream.
- WebKit::WebVector<WebKit::WebMediaStreamDescriptor> empty_streams(
- static_cast<size_t>(0));
- pc_handler_->removeStream(local_stream);
- EXPECT_EQ("", mock_peer_connection_->stream_label());
-
- // On remove stream.
- pc_handler_->OnRemoveStream(remote_stream);
- EXPECT_TRUE(mock_client_->stream_label().empty());
-
- // Add stream again.
- pc_handler_->addStream(local_stream);
- EXPECT_EQ(stream_label, mock_peer_connection_->stream_label());
-
- // On state change.
- mock_peer_connection_->SetReadyState(
- webrtc::PeerConnectionInterface::kActive);
- webrtc::PeerConnectionObserver::StateType state =
- webrtc::PeerConnectionObserver::kReadyState;
- pc_handler_->OnStateChange(state);
- EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive,
- mock_client_->ready_state());
-
- // On ICE candidate.
- std::string candidate_label = "0";
- std::string candidate_sdp = "test sdp";
- int sdp_mline_index = 0;
- scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
- mock_dependency_factory_->CreateIceCandidate(candidate_label,
- sdp_mline_index,
- candidate_sdp));
- pc_handler_->OnIceCandidate(native_candidate.get());
- EXPECT_EQ(candidate_label, mock_client_->candidate_label());
- EXPECT_EQ(candidate_sdp, mock_client_->candidate_sdp());
- EXPECT_TRUE(mock_client_->more_to_follow());
-
- // On ICE complete.
- pc_handler_->OnIceComplete();
- EXPECT_TRUE(mock_client_->candidate_label().empty());
- EXPECT_TRUE(mock_client_->candidate_sdp().empty());
- EXPECT_FALSE(mock_client_->more_to_follow());
-
- // Stop.
- pc_handler_->stop();
- EXPECT_FALSE(pc_handler_->native_peer_connection());
-
- // PC handler is expected to be deleted when stop calls
- // MediaStreamImpl::ClosePeerConnection. We own and delete it here instead of
- // in the mock.
- pc_handler_.reset();
-}
-
-// Test that the glue code can receive multiple media streams and can set a
-// video renderer on each media stream.
-TEST_F(PeerConnectionHandlerJsepTest, ReceiveMultipleRemoteStreams) {
- std::string stream_label_1 = "remote_stream_1";
- std::string video_track_label_1 = "remote_video_track_1";
- std::string audio_track_label_1 = "remote_audio_track_1";
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_1(
- AddRemoteMockMediaStream(stream_label_1, video_track_label_1,
- audio_track_label_1));
- std::string stream_label_2 = "remote_stream_2";
- std::string video_track_label_2 = "remote_video_track_2";
- std::string audio_track_label_2 = "remote_audio_track_2";
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2(
- AddRemoteMockMediaStream(stream_label_2, video_track_label_2,
- audio_track_label_2));
-
- pc_handler_->OnAddStream(stream_1);
- EXPECT_EQ(stream_label_1, mock_client_->stream_label());
-
- pc_handler_->OnAddStream(stream_2);
- EXPECT_EQ(stream_label_2, mock_client_->stream_label());
-}
-
-} // namespace content
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index ab42054..9436e65 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -634,8 +634,6 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
WebKit::WebRuntimeFeatures::enableMediaStream(true);
WebKit::WebRuntimeFeatures::enablePeerConnection(true);
- WebKit::WebRuntimeFeatures::enableDeprecatedPeerConnection(
- command_line.HasSwitch(switches::kEnableDeprecatedPeerConnection));
WebKit::WebRuntimeFeatures::enableFullScreenAPI(
!command_line.HasSwitch(switches::kDisableFullScreen));
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index d0f7bf5..3e59258 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -157,10 +157,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h"
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 010f4e4..2200150 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -86,8 +86,6 @@ using WebKit::WebIDBFactory;
using WebKit::WebKitPlatformSupport;
using WebKit::WebMediaStreamCenter;
using WebKit::WebMediaStreamCenterClient;
-using WebKit::WebPeerConnection00Handler;
-using WebKit::WebPeerConnection00HandlerClient;
using WebKit::WebRTCPeerConnectionHandler;
using WebKit::WebRTCPeerConnectionHandlerClient;
using WebKit::WebStorageNamespace;
@@ -672,22 +670,6 @@ void RendererWebKitPlatformSupportImpl::GetPlugins(
//------------------------------------------------------------------------------
-WebPeerConnection00Handler*
-RendererWebKitPlatformSupportImpl::createPeerConnection00Handler(
- WebPeerConnection00HandlerClient* client) {
- RenderThreadImpl* render_thread = RenderThreadImpl::current();
- DCHECK(render_thread);
- if (!render_thread)
- return NULL;
-#if defined(ENABLE_WEBRTC)
- MediaStreamDependencyFactory* rtc_dependency_factory =
- render_thread->GetMediaStreamDependencyFactory();
- return rtc_dependency_factory->CreatePeerConnectionHandlerJsep(client);
-#else
- return NULL;
-#endif // defined(ENABLE_WEBRTC)
-}
-
WebRTCPeerConnectionHandler*
RendererWebKitPlatformSupportImpl::createRTCPeerConnectionHandler(
WebRTCPeerConnectionHandlerClient* client) {
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h
index ba95ba7..920bfd9 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.h
+++ b/content/renderer/renderer_webkitplatformsupport_impl.h
@@ -79,8 +79,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
virtual WebKit::WebString userAgent(const WebKit::WebURL& url) OVERRIDE;
virtual void GetPlugins(bool refresh,
std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE;
- virtual WebKit::WebPeerConnection00Handler* createPeerConnection00Handler(
- WebKit::WebPeerConnection00HandlerClient* client) OVERRIDE;
virtual WebKit::WebRTCPeerConnectionHandler* createRTCPeerConnectionHandler(
WebKit::WebRTCPeerConnectionHandlerClient* client) OVERRIDE;
virtual WebKit::WebMediaStreamCenter* createMediaStreamCenter(