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

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

Issue 129923002: Implements MediaStreamVideoSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implements MediaStreamVideoSource. Created 6 years, 11 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_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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 case blink::WebMediaStreamSource::TypeAudio: 564 case blink::WebMediaStreamSource::TypeAudio:
565 return native_stream->RemoveTrack( 565 return native_stream->RemoveTrack(
566 native_stream->FindAudioTrack(track_id)); 566 native_stream->FindAudioTrack(track_id));
567 case blink::WebMediaStreamSource::TypeVideo: 567 case blink::WebMediaStreamSource::TypeVideo:
568 return native_stream->RemoveTrack( 568 return native_stream->RemoveTrack(
569 native_stream->FindVideoTrack(track_id)); 569 native_stream->FindVideoTrack(track_id));
570 } 570 }
571 return false; 571 return false;
572 } 572 }
573 573
574 scoped_refptr<webrtc::VideoSourceInterface>
575 MediaStreamDependencyFactory::CreateVideoSource(
576 cricket::VideoCapturer* capturer,
577 const webrtc::MediaConstraintsInterface* constraints) {
578 scoped_refptr<webrtc::VideoSourceInterface> source =
579 pc_factory_->CreateVideoSource(capturer, constraints).get();
580 return source;
581 }
582
574 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { 583 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
575 DCHECK(!pc_factory_.get()); 584 DCHECK(!pc_factory_.get());
576 DCHECK(!audio_device_.get()); 585 DCHECK(!audio_device_.get());
577 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; 586 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()";
578 587
579 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; 588 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
580 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; 589 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
581 590
582 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 591 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
583 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = 592 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories =
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 scoped_refptr<webrtc::VideoSourceInterface> 693 scoped_refptr<webrtc::VideoSourceInterface>
685 MediaStreamDependencyFactory::CreateLocalVideoSource( 694 MediaStreamDependencyFactory::CreateLocalVideoSource(
686 int video_session_id, 695 int video_session_id,
687 bool is_screencast, 696 bool is_screencast,
688 const webrtc::MediaConstraintsInterface* constraints) { 697 const webrtc::MediaConstraintsInterface* constraints) {
689 RtcVideoCapturer* capturer = new RtcVideoCapturer( 698 RtcVideoCapturer* capturer = new RtcVideoCapturer(
690 video_session_id, is_screencast); 699 video_session_id, is_screencast);
691 700
692 // The video source takes ownership of |capturer|. 701 // The video source takes ownership of |capturer|.
693 scoped_refptr<webrtc::VideoSourceInterface> source = 702 scoped_refptr<webrtc::VideoSourceInterface> source =
694 pc_factory_->CreateVideoSource(capturer, constraints).get(); 703 CreateVideoSource(capturer, constraints);
695 return source; 704 return source;
696 } 705 }
697 706
698 scoped_refptr<WebAudioCapturerSource> 707 scoped_refptr<WebAudioCapturerSource>
699 MediaStreamDependencyFactory::CreateWebAudioSource( 708 MediaStreamDependencyFactory::CreateWebAudioSource(
700 blink::WebMediaStreamSource* source, 709 blink::WebMediaStreamSource* source,
701 const RTCMediaConstraints& constraints) { 710 const RTCMediaConstraints& constraints) {
702 DVLOG(1) << "MediaStreamDependencyFactory::CreateWebAudioSource()"; 711 DVLOG(1) << "MediaStreamDependencyFactory::CreateWebAudioSource()";
703 DCHECK(GetWebRtcAudioDevice()); 712 DCHECK(GetWebRtcAudioDevice());
704 713
(...skipping 22 matching lines...) Expand all
727 scoped_refptr<webrtc::VideoTrackInterface> 736 scoped_refptr<webrtc::VideoTrackInterface>
728 MediaStreamDependencyFactory::CreateLocalVideoTrack( 737 MediaStreamDependencyFactory::CreateLocalVideoTrack(
729 const std::string& id, cricket::VideoCapturer* capturer) { 738 const std::string& id, cricket::VideoCapturer* capturer) {
730 if (!capturer) { 739 if (!capturer) {
731 LOG(ERROR) << "CreateLocalVideoTrack called with null VideoCapturer."; 740 LOG(ERROR) << "CreateLocalVideoTrack called with null VideoCapturer.";
732 return NULL; 741 return NULL;
733 } 742 }
734 743
735 // Create video source from the |capturer|. 744 // Create video source from the |capturer|.
736 scoped_refptr<webrtc::VideoSourceInterface> source = 745 scoped_refptr<webrtc::VideoSourceInterface> source =
737 pc_factory_->CreateVideoSource(capturer, NULL).get(); 746 CreateVideoSource(capturer, NULL);
738 747
739 // Create native track from the source. 748 // Create native track from the source.
740 return pc_factory_->CreateVideoTrack(id, source.get()).get(); 749 return pc_factory_->CreateVideoTrack(id, source.get()).get();
741 } 750 }
742 751
743 scoped_refptr<webrtc::AudioTrackInterface> 752 scoped_refptr<webrtc::AudioTrackInterface>
744 MediaStreamDependencyFactory::CreateLocalAudioTrack( 753 MediaStreamDependencyFactory::CreateLocalAudioTrack(
745 const std::string& id, 754 const std::string& id,
746 const scoped_refptr<WebRtcAudioCapturer>& capturer, 755 const scoped_refptr<WebRtcAudioCapturer>& capturer,
747 WebAudioCapturerSource* webaudio_source, 756 WebAudioCapturerSource* webaudio_source,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 if (!aec_dump_file_stream) { 1009 if (!aec_dump_file_stream) {
1001 VLOG(1) << "Could not open AEC dump file."; 1010 VLOG(1) << "Could not open AEC dump file.";
1002 base::ClosePlatformFile(aec_dump_file); 1011 base::ClosePlatformFile(aec_dump_file);
1003 } else { 1012 } else {
1004 // |pc_factory_| takes ownership of |aec_dump_file_stream|. 1013 // |pc_factory_| takes ownership of |aec_dump_file_stream|.
1005 pc_factory_->StartAecDump(aec_dump_file_stream); 1014 pc_factory_->StartAecDump(aec_dump_file_stream);
1006 } 1015 }
1007 } 1016 }
1008 1017
1009 } // namespace content 1018 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_dependency_factory.h ('k') | content/renderer/media/media_stream_video_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698