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

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

Issue 9309078: Adding a skeleton MediaStreamCenter. (Closed)
Patch Set: Fixed review comments Created 8 years, 10 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
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_center.h"
14 #include "content/renderer/media/media_stream_dependency_factory.h" 15 #include "content/renderer/media/media_stream_dependency_factory.h"
15 #include "content/renderer/media/media_stream_dispatcher.h" 16 #include "content/renderer/media/media_stream_dispatcher.h"
16 #include "content/renderer/media/peer_connection_handler.h" 17 #include "content/renderer/media/peer_connection_handler.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"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 MediaStreamDispatcher* media_stream_dispatcher, 75 MediaStreamDispatcher* media_stream_dispatcher,
75 content::P2PSocketDispatcher* p2p_socket_dispatcher, 76 content::P2PSocketDispatcher* p2p_socket_dispatcher,
76 VideoCaptureImplManager* vc_manager, 77 VideoCaptureImplManager* vc_manager,
77 MediaStreamDependencyFactory* dependency_factory) 78 MediaStreamDependencyFactory* dependency_factory)
78 : dependency_factory_(dependency_factory), 79 : dependency_factory_(dependency_factory),
79 media_stream_dispatcher_(media_stream_dispatcher), 80 media_stream_dispatcher_(media_stream_dispatcher),
80 p2p_socket_dispatcher_(p2p_socket_dispatcher), 81 p2p_socket_dispatcher_(p2p_socket_dispatcher),
81 network_manager_(NULL), 82 network_manager_(NULL),
82 vc_manager_(vc_manager), 83 vc_manager_(vc_manager),
83 peer_connection_handler_(NULL), 84 peer_connection_handler_(NULL),
85 media_stream_center_(NULL),
84 message_loop_proxy_(base::MessageLoopProxy::current()), 86 message_loop_proxy_(base::MessageLoopProxy::current()),
85 signaling_thread_(NULL), 87 signaling_thread_(NULL),
86 worker_thread_(NULL), 88 worker_thread_(NULL),
87 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { 89 chrome_worker_thread_("Chrome_libJingle_WorkerThread") {
88 } 90 }
89 91
90 MediaStreamImpl::~MediaStreamImpl() { 92 MediaStreamImpl::~MediaStreamImpl() {
91 DCHECK(!peer_connection_handler_); 93 DCHECK(!peer_connection_handler_);
92 if (dependency_factory_.get()) 94 if (dependency_factory_.get())
93 dependency_factory_->ReleasePeerConnectionFactory(); 95 dependency_factory_->ReleasePeerConnectionFactory();
(...skipping 24 matching lines...) Expand all
118 EnsurePeerConnectionFactory(); 120 EnsurePeerConnectionFactory();
119 121
120 peer_connection_handler_ = new PeerConnectionHandler( 122 peer_connection_handler_ = new PeerConnectionHandler(
121 client, 123 client,
122 this, 124 this,
123 dependency_factory_.get()); 125 dependency_factory_.get());
124 126
125 return peer_connection_handler_; 127 return peer_connection_handler_;
126 } 128 }
127 129
130 WebKit::WebMediaStreamCenter* MediaStreamImpl::CreateMediaStreamCenter(
131 WebKit::WebMediaStreamCenterClient* client) {
132 DCHECK(CalledOnValidThread());
133 DCHECK(!media_stream_center_);
134
135 media_stream_center_ = new content::MediaStreamCenter(client);
136 return media_stream_center_;
137 }
138
128 void MediaStreamImpl::ClosePeerConnection() { 139 void MediaStreamImpl::ClosePeerConnection() {
129 DCHECK(CalledOnValidThread()); 140 DCHECK(CalledOnValidThread());
130 video_renderer_ = NULL; 141 video_renderer_ = NULL;
131 peer_connection_handler_ = NULL; 142 peer_connection_handler_ = NULL;
132 // TODO(grunell): This is a temporary workaround for an error in native 143 // TODO(grunell): This is a temporary workaround for an error in native
133 // PeerConnection where added live tracks are not seen on the remote side. 144 // PeerConnection where added live tracks are not seen on the remote side.
134 MediaStreamTrackPtrMap::const_iterator it = local_tracks_.begin(); 145 MediaStreamTrackPtrMap::const_iterator it = local_tracks_.begin();
135 for (; it != local_tracks_.end(); ++it) 146 for (; it != local_tracks_.end(); ++it)
136 it->second->set_state(webrtc::MediaStreamTrackInterface::kEnded); 147 it->second->set_state(webrtc::MediaStreamTrackInterface::kEnded);
137 } 148 }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 464 }
454 465
455 MediaStreamImpl::VideoRendererWrapper::VideoRendererWrapper() {} 466 MediaStreamImpl::VideoRendererWrapper::VideoRendererWrapper() {}
456 467
457 MediaStreamImpl::VideoRendererWrapper::~VideoRendererWrapper() {} 468 MediaStreamImpl::VideoRendererWrapper::~VideoRendererWrapper() {}
458 469
459 void MediaStreamImpl::VideoRendererWrapper::SetVideoDecoder( 470 void MediaStreamImpl::VideoRendererWrapper::SetVideoDecoder(
460 RTCVideoDecoder* decoder) { 471 RTCVideoDecoder* decoder) {
461 rtc_video_decoder_ = decoder; 472 rtc_video_decoder_ = decoder;
462 } 473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698