Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 case blink::WebMediaStreamSource::TypeAudio: | 604 case blink::WebMediaStreamSource::TypeAudio: |
| 605 return native_stream->RemoveTrack( | 605 return native_stream->RemoveTrack( |
| 606 native_stream->FindAudioTrack(track_id)); | 606 native_stream->FindAudioTrack(track_id)); |
| 607 case blink::WebMediaStreamSource::TypeVideo: | 607 case blink::WebMediaStreamSource::TypeVideo: |
| 608 return native_stream->RemoveTrack( | 608 return native_stream->RemoveTrack( |
| 609 native_stream->FindVideoTrack(track_id)); | 609 native_stream->FindVideoTrack(track_id)); |
| 610 } | 610 } |
| 611 return false; | 611 return false; |
| 612 } | 612 } |
| 613 | 613 |
| 614 scoped_refptr<webrtc::VideoSourceInterface> | |
| 615 MediaStreamDependencyFactory::CreateVideoSource( | |
| 616 cricket::VideoCapturer* capturer, | |
| 617 const webrtc::MediaConstraintsInterface* constraints) { | |
| 618 // The video source takes ownership of |capturer|. | |
|
no longer working on chromium
2014/01/15 15:57:22
nit, can you move this comment to the interface in
Ronghua Wu (Left Chromium)
2014/01/15 18:38:58
Done.
| |
| 619 scoped_refptr<webrtc::VideoSourceInterface> source = | |
|
perkj_chrome
2014/01/15 16:24:54
I just realized that you probably have to call Ens
Ronghua Wu (Left Chromium)
2014/01/15 18:38:58
I think it's the callers's responsibility to do th
| |
| 620 pc_factory_->CreateVideoSource(capturer, constraints).get(); | |
| 621 return source; | |
| 622 } | |
| 623 | |
| 614 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 624 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
| 615 DCHECK(!pc_factory_.get()); | 625 DCHECK(!pc_factory_.get()); |
| 616 DCHECK(!audio_device_.get()); | 626 DCHECK(!audio_device_.get()); |
| 617 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 627 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
| 618 | 628 |
| 619 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; | 629 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; |
| 620 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; | 630 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; |
| 621 | 631 |
| 622 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 632 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 623 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = | 633 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 scoped_refptr<webrtc::VideoSourceInterface> | 734 scoped_refptr<webrtc::VideoSourceInterface> |
| 725 MediaStreamDependencyFactory::CreateLocalVideoSource( | 735 MediaStreamDependencyFactory::CreateLocalVideoSource( |
| 726 int video_session_id, | 736 int video_session_id, |
| 727 bool is_screencast, | 737 bool is_screencast, |
| 728 const webrtc::MediaConstraintsInterface* constraints) { | 738 const webrtc::MediaConstraintsInterface* constraints) { |
| 729 RtcVideoCapturer* capturer = new RtcVideoCapturer( | 739 RtcVideoCapturer* capturer = new RtcVideoCapturer( |
| 730 video_session_id, is_screencast); | 740 video_session_id, is_screencast); |
| 731 | 741 |
| 732 // The video source takes ownership of |capturer|. | 742 // The video source takes ownership of |capturer|. |
| 733 scoped_refptr<webrtc::VideoSourceInterface> source = | 743 scoped_refptr<webrtc::VideoSourceInterface> source = |
| 734 pc_factory_->CreateVideoSource(capturer, constraints).get(); | 744 CreateVideoSource(capturer, constraints); |
| 735 return source; | 745 return source; |
| 736 } | 746 } |
| 737 | 747 |
| 738 scoped_refptr<WebAudioCapturerSource> | 748 scoped_refptr<WebAudioCapturerSource> |
| 739 MediaStreamDependencyFactory::CreateWebAudioSource( | 749 MediaStreamDependencyFactory::CreateWebAudioSource( |
| 740 blink::WebMediaStreamSource* source, | 750 blink::WebMediaStreamSource* source, |
| 741 RTCMediaConstraints* constraints) { | 751 RTCMediaConstraints* constraints) { |
| 742 DVLOG(1) << "MediaStreamDependencyFactory::CreateWebAudioSource()"; | 752 DVLOG(1) << "MediaStreamDependencyFactory::CreateWebAudioSource()"; |
| 743 DCHECK(GetWebRtcAudioDevice()); | 753 DCHECK(GetWebRtcAudioDevice()); |
| 744 | 754 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 767 scoped_refptr<webrtc::VideoTrackInterface> | 777 scoped_refptr<webrtc::VideoTrackInterface> |
| 768 MediaStreamDependencyFactory::CreateLocalVideoTrack( | 778 MediaStreamDependencyFactory::CreateLocalVideoTrack( |
| 769 const std::string& id, cricket::VideoCapturer* capturer) { | 779 const std::string& id, cricket::VideoCapturer* capturer) { |
| 770 if (!capturer) { | 780 if (!capturer) { |
| 771 LOG(ERROR) << "CreateLocalVideoTrack called with null VideoCapturer."; | 781 LOG(ERROR) << "CreateLocalVideoTrack called with null VideoCapturer."; |
| 772 return NULL; | 782 return NULL; |
| 773 } | 783 } |
| 774 | 784 |
| 775 // Create video source from the |capturer|. | 785 // Create video source from the |capturer|. |
| 776 scoped_refptr<webrtc::VideoSourceInterface> source = | 786 scoped_refptr<webrtc::VideoSourceInterface> source = |
| 777 pc_factory_->CreateVideoSource(capturer, NULL).get(); | 787 CreateVideoSource(capturer, NULL); |
| 778 | 788 |
| 779 // Create native track from the source. | 789 // Create native track from the source. |
| 780 return pc_factory_->CreateVideoTrack(id, source.get()).get(); | 790 return pc_factory_->CreateVideoTrack(id, source.get()).get(); |
| 781 } | 791 } |
| 782 | 792 |
| 783 scoped_refptr<webrtc::AudioTrackInterface> | 793 scoped_refptr<webrtc::AudioTrackInterface> |
| 784 MediaStreamDependencyFactory::CreateLocalAudioTrack( | 794 MediaStreamDependencyFactory::CreateLocalAudioTrack( |
| 785 const std::string& id, | 795 const std::string& id, |
| 786 const scoped_refptr<WebRtcAudioCapturer>& capturer, | 796 const scoped_refptr<WebRtcAudioCapturer>& capturer, |
| 787 WebAudioCapturerSource* webaudio_source, | 797 WebAudioCapturerSource* webaudio_source, |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1040 if (!aec_dump_file_stream) { | 1050 if (!aec_dump_file_stream) { |
| 1041 VLOG(1) << "Could not open AEC dump file."; | 1051 VLOG(1) << "Could not open AEC dump file."; |
| 1042 base::ClosePlatformFile(aec_dump_file); | 1052 base::ClosePlatformFile(aec_dump_file); |
| 1043 } else { | 1053 } else { |
| 1044 // |pc_factory_| takes ownership of |aec_dump_file_stream|. | 1054 // |pc_factory_| takes ownership of |aec_dump_file_stream|. |
| 1045 pc_factory_->StartAecDump(aec_dump_file_stream); | 1055 pc_factory_->StartAecDump(aec_dump_file_stream); |
| 1046 } | 1056 } |
| 1047 } | 1057 } |
| 1048 | 1058 |
| 1049 } // namespace content | 1059 } // namespace content |
| OLD | NEW |