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

Unified Diff: content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 2356663002: Implement and use VideoTrackSource directly. (Closed)
Patch Set: add test TODO Created 4 years, 3 months 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
Index: content/renderer/media/webrtc/peer_connection_dependency_factory.cc
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
index 93b7f2fbef930f5cc0f39b36d14d91c76098ed39..50557a04861597913b04851da3426c22c9174bdc 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -62,6 +62,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/webrtc/api/mediaconstraintsinterface.h"
+#include "third_party/webrtc/api/videosourceproxy.h"
#include "third_party/webrtc/base/ssladapter.h"
#include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h"
@@ -125,26 +126,6 @@ PeerConnectionDependencyFactory::CreateRTCPeerConnectionHandler(
return new RTCPeerConnectionHandler(client, this);
}
-WebRtcVideoCapturerAdapter*
-PeerConnectionDependencyFactory::CreateVideoCapturer(
- bool is_screeencast) {
- // We need to make sure the libjingle thread wrappers have been created
- // before we can use an instance of a WebRtcVideoCapturerAdapter. This is
- // since the base class of WebRtcVideoCapturerAdapter is a
- // cricket::VideoCapturer and it uses the libjingle thread wrappers.
- if (!GetPcFactory().get())
- return NULL;
- return new WebRtcVideoCapturerAdapter(is_screeencast);
-}
-
-scoped_refptr<webrtc::VideoTrackSourceInterface>
-PeerConnectionDependencyFactory::CreateVideoSource(
- cricket::VideoCapturer* capturer) {
- scoped_refptr<webrtc::VideoTrackSourceInterface> source =
- GetPcFactory()->CreateVideoSource(capturer).get();
- return source;
-}
-
const scoped_refptr<webrtc::PeerConnectionFactoryInterface>&
PeerConnectionDependencyFactory::GetPcFactory() {
if (!pc_factory_.get())
@@ -422,27 +403,24 @@ PeerConnectionDependencyFactory::CreateLocalMediaStream(
return GetPcFactory()->CreateLocalMediaStream(label).get();
}
-scoped_refptr<webrtc::VideoTrackInterface>
-PeerConnectionDependencyFactory::CreateLocalVideoTrack(
- const std::string& id,
+scoped_refptr<webrtc::VideoTrackSourceInterface>
+PeerConnectionDependencyFactory::CreateVideoTrackSourceProxy(
webrtc::VideoTrackSourceInterface* source) {
- return GetPcFactory()->CreateVideoTrack(id, source).get();
+ // PeerConnectionFactory needs to be instantiated to make sure that
+ // signaling_thread_ and worker_thread_ exist.
+ if (!PeerConnectionFactoryCreated())
+ CreatePeerConnectionFactory();
+
+ return webrtc::VideoTrackSourceProxy::Create(signaling_thread_,
+ worker_thread_, source)
+ .get();
}
scoped_refptr<webrtc::VideoTrackInterface>
PeerConnectionDependencyFactory::CreateLocalVideoTrack(
- const std::string& id, cricket::VideoCapturer* capturer) {
- if (!capturer) {
- LOG(ERROR) << "CreateLocalVideoTrack called with null VideoCapturer.";
- return NULL;
- }
-
- // Create video source from the |capturer|.
- scoped_refptr<webrtc::VideoTrackSourceInterface> source =
- GetPcFactory()->CreateVideoSource(capturer, NULL).get();
-
- // Create native track from the source.
- return GetPcFactory()->CreateVideoTrack(id, source.get()).get();
+ const std::string& id,
+ webrtc::VideoTrackSourceInterface* source) {
+ return GetPcFactory()->CreateVideoTrack(id, source).get();
}
webrtc::SessionDescriptionInterface*

Powered by Google App Engine
This is Rietveld 408576698