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

Side by Side Diff: content/renderer/media/media_stream_impl.cc

Issue 9699069: Adding JSEP PeerConnection glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/media_stream_impl.h" 5 #include "content/renderer/media/media_stream_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "content/renderer/media/capture_video_decoder.h" 13 #include "content/renderer/media/capture_video_decoder.h"
14 #include "content/renderer/media/media_stream_dependency_factory.h" 14 #include "content/renderer/media/media_stream_dependency_factory.h"
15 #include "content/renderer/media/media_stream_dispatcher.h" 15 #include "content/renderer/media/media_stream_dispatcher.h"
16 #include "content/renderer/media/peer_connection_handler.h" 16 #include "content/renderer/media/peer_connection_handler.h"
17 #include "content/renderer/media/peer_connection_handler_jsep.h"
17 #include "content/renderer/media/video_capture_impl_manager.h" 18 #include "content/renderer/media/video_capture_impl_manager.h"
18 #include "content/renderer/media/video_capture_module_impl.h" 19 #include "content/renderer/media/video_capture_module_impl.h"
19 #include "content/renderer/media/webrtc_audio_device_impl.h" 20 #include "content/renderer/media/webrtc_audio_device_impl.h"
20 #include "content/renderer/p2p/ipc_network_manager.h" 21 #include "content/renderer/p2p/ipc_network_manager.h"
21 #include "content/renderer/p2p/ipc_socket_factory.h" 22 #include "content/renderer/p2p/ipc_socket_factory.h"
22 #include "content/renderer/p2p/socket_dispatcher.h" 23 #include "content/renderer/p2p/socket_dispatcher.h"
23 #include "jingle/glue/thread_wrapper.h" 24 #include "jingle/glue/thread_wrapper.h"
24 #include "media/base/message_loop_factory.h" 25 #include "media/base/message_loop_factory.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaStreamRegistr y.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaStreamRegistr y.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler( 112 WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler(
112 WebKit::WebPeerConnectionHandlerClient* client) { 113 WebKit::WebPeerConnectionHandlerClient* client) {
113 DCHECK(CalledOnValidThread()); 114 DCHECK(CalledOnValidThread());
114 if (peer_connection_handler_) { 115 if (peer_connection_handler_) {
115 DVLOG(1) << "A PeerConnection already exists"; 116 DVLOG(1) << "A PeerConnection already exists";
116 return NULL; 117 return NULL;
117 } 118 }
118 if (!EnsurePeerConnectionFactory()) 119 if (!EnsurePeerConnectionFactory())
119 return NULL; 120 return NULL;
120 121
121 peer_connection_handler_ = new PeerConnectionHandler( 122 PeerConnectionHandler* pc_handler = new PeerConnectionHandler(
123 client,
tommi (sloooow) - chröme 2012/03/15 12:31:52 strange indent. run lint?
Henrik Grunell 2012/03/23 12:50:45 Done.
124 this,
125 dependency_factory_.get());
126
127 peer_connection_handler_ = pc_handler;
128 return pc_handler;
129 }
130
131 WebKit::WebJSEPPeerConnectionHandler*
132 MediaStreamImpl::CreatePeerConnectionHandlerJsep(
133 WebKit::WebJSEPPeerConnectionHandlerClient* client) {
134 DCHECK(CalledOnValidThread());
135 if (peer_connection_handler_) {
136 DVLOG(1) << "A PeerConnection already exists";
137 return NULL;
138 }
139 if (!EnsurePeerConnectionFactory())
140 return NULL;
141
142 PeerConnectionHandlerJsep* pc_handler = new PeerConnectionHandlerJsep(
122 client, 143 client,
123 this, 144 this,
124 dependency_factory_.get()); 145 dependency_factory_.get());
125 146
126 return peer_connection_handler_; 147 peer_connection_handler_ = pc_handler;
148 return pc_handler;
127 } 149 }
128 150
129 void MediaStreamImpl::ClosePeerConnection() { 151 void MediaStreamImpl::ClosePeerConnection() {
130 DCHECK(CalledOnValidThread()); 152 DCHECK(CalledOnValidThread());
131 video_renderer_ = NULL; 153 video_renderer_ = NULL;
132 peer_connection_handler_ = NULL; 154 peer_connection_handler_ = NULL;
133 // TODO(grunell): This is a temporary workaround for an error in native 155 // TODO(grunell): This is a temporary workaround for an error in native
134 // PeerConnection where added live tracks are not seen on the remote side. 156 // PeerConnection where added live tracks are not seen on the remote side.
135 MediaStreamTrackPtrMap::const_iterator it = local_tracks_.begin(); 157 MediaStreamTrackPtrMap::const_iterator it = local_tracks_.begin();
136 for (; it != local_tracks_.end(); ++it) 158 for (; it != local_tracks_.end(); ++it)
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 493 }
472 494
473 MediaStreamImpl::VideoRendererWrapper::VideoRendererWrapper() {} 495 MediaStreamImpl::VideoRendererWrapper::VideoRendererWrapper() {}
474 496
475 MediaStreamImpl::VideoRendererWrapper::~VideoRendererWrapper() {} 497 MediaStreamImpl::VideoRendererWrapper::~VideoRendererWrapper() {}
476 498
477 void MediaStreamImpl::VideoRendererWrapper::SetVideoDecoder( 499 void MediaStreamImpl::VideoRendererWrapper::SetVideoDecoder(
478 RTCVideoDecoder* decoder) { 500 RTCVideoDecoder* decoder) {
479 rtc_video_decoder_ = decoder; 501 rtc_video_decoder_ = decoder;
480 } 502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698