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

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

Issue 282523003: Deliver video frames on libjingle worker thread to WebRtcVideoCapturerAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Tommis comments. Created 6 years, 7 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_dependency_factory.h" 5 #include "content/renderer/media/media_stream_dependency_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 232
233 WebRtcVideoCapturerAdapter* MediaStreamDependencyFactory::CreateVideoCapturer( 233 WebRtcVideoCapturerAdapter* MediaStreamDependencyFactory::CreateVideoCapturer(
234 bool is_screeencast) { 234 bool is_screeencast) {
235 // We need to make sure the libjingle thread wrappers have been created 235 // We need to make sure the libjingle thread wrappers have been created
236 // before we can use an instance of a WebRtcVideoCapturerAdapter. This is 236 // before we can use an instance of a WebRtcVideoCapturerAdapter. This is
237 // since the base class of WebRtcVideoCapturerAdapter is a 237 // since the base class of WebRtcVideoCapturerAdapter is a
238 // cricket::VideoCapturer and it uses the libjingle thread wrappers. 238 // cricket::VideoCapturer and it uses the libjingle thread wrappers.
239 if (!GetPcFactory()) 239 if (!GetPcFactory())
240 return NULL; 240 return NULL;
241 return new WebRtcVideoCapturerAdapter(is_screeencast); 241 return new WebRtcVideoCapturerAdapter(GetWebRtcWorkerThread(),
242 is_screeencast);
242 } 243 }
243 244
244 scoped_refptr<webrtc::VideoSourceInterface> 245 scoped_refptr<webrtc::VideoSourceInterface>
245 MediaStreamDependencyFactory::CreateVideoSource( 246 MediaStreamDependencyFactory::CreateVideoSource(
246 cricket::VideoCapturer* capturer, 247 cricket::VideoCapturer* capturer,
247 const blink::WebMediaConstraints& constraints) { 248 const blink::WebMediaConstraints& constraints) {
248 RTCMediaConstraints webrtc_constraints(constraints); 249 RTCMediaConstraints webrtc_constraints(constraints);
249 scoped_refptr<webrtc::VideoSourceInterface> source = 250 scoped_refptr<webrtc::VideoSourceInterface> source =
250 GetPcFactory()->CreateVideoSource(capturer, &webrtc_constraints).get(); 251 GetPcFactory()->CreateVideoSource(capturer, &webrtc_constraints).get();
251 return source; 252 return source;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 webkit_track.source().type()); 595 webkit_track.source().type());
595 blink::WebMediaStreamTrack track = webkit_track; 596 blink::WebMediaStreamTrack track = webkit_track;
596 597
597 DVLOG(1) << "AddNativeTrackToBlinkTrack() audio"; 598 DVLOG(1) << "AddNativeTrackToBlinkTrack() audio";
598 track.setExtraData( 599 track.setExtraData(
599 new MediaStreamTrack( 600 new MediaStreamTrack(
600 static_cast<webrtc::AudioTrackInterface*>(native_track), 601 static_cast<webrtc::AudioTrackInterface*>(native_track),
601 is_local_track)); 602 is_local_track));
602 } 603 }
603 604
605 scoped_refptr<base::MessageLoopProxy>
606 MediaStreamDependencyFactory::GetWebRtcWorkerThread() const {
607 DCHECK(CalledOnValidThread());
608 return chrome_worker_thread_.message_loop_proxy();
609 }
610
604 bool MediaStreamDependencyFactory::OnControlMessageReceived( 611 bool MediaStreamDependencyFactory::OnControlMessageReceived(
605 const IPC::Message& message) { 612 const IPC::Message& message) {
606 bool handled = true; 613 bool handled = true;
607 IPC_BEGIN_MESSAGE_MAP(MediaStreamDependencyFactory, message) 614 IPC_BEGIN_MESSAGE_MAP(MediaStreamDependencyFactory, message)
608 IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile) 615 IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile)
609 IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump) 616 IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump)
610 IPC_MESSAGE_UNHANDLED(handled = false) 617 IPC_MESSAGE_UNHANDLED(handled = false)
611 IPC_END_MESSAGE_MAP() 618 IPC_END_MESSAGE_MAP()
612 return handled; 619 return handled;
613 } 620 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 } 661 }
655 662
656 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 663 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
657 if (audio_device_) 664 if (audio_device_)
658 return; 665 return;
659 666
660 audio_device_ = new WebRtcAudioDeviceImpl(); 667 audio_device_ = new WebRtcAudioDeviceImpl();
661 } 668 }
662 669
663 } // namespace content 670 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698