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

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: 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 case blink::WebMediaStreamSource::TypeAudio: 607 case blink::WebMediaStreamSource::TypeAudio:
608 return native_stream->RemoveTrack( 608 return native_stream->RemoveTrack(
609 native_stream->FindAudioTrack(track_id)); 609 native_stream->FindAudioTrack(track_id));
610 case blink::WebMediaStreamSource::TypeVideo: 610 case blink::WebMediaStreamSource::TypeVideo:
611 return native_stream->RemoveTrack( 611 return native_stream->RemoveTrack(
612 native_stream->FindVideoTrack(track_id)); 612 native_stream->FindVideoTrack(track_id));
613 } 613 }
614 return false; 614 return false;
615 } 615 }
616 616
617 blink::WebMediaStreamTrack
618 MediaStreamDependencyFactory::CreateMediaStreamVideoTrack(
perkj_chrome 2014/01/10 13:07:00 I am not sure this belong here. The dependency fac
Ronghua Wu (Left Chromium) 2014/01/11 01:22:58 Not sure where else should I put this though. The
619 const std::string& id) {
620 blink::WebMediaStreamTrack track;
621 blink::WebMediaStreamSource source;
622 blink::WebString idw(base::UTF8ToUTF16(id));
623 source.initialize(idw, blink::WebMediaStreamSource::TypeVideo, idw);
624 track.initialize(idw, source);
625 return track;
626 }
627
628 scoped_refptr<webrtc::VideoSourceInterface>
629 MediaStreamDependencyFactory::CreateVideoSource(
perkj_chrome 2014/01/10 13:07:00 Make sure this method is used everywhere in this c
Ronghua Wu (Left Chromium) 2014/01/11 01:22:58 Done.
630 cricket::VideoCapturer* capturer,
631 const blink::WebMediaConstraints& constraints) {
632 RTCMediaConstraints native_constraints(constraints);
633 // The video source takes ownership of |capturer|.
634 scoped_refptr<webrtc::VideoSourceInterface> source =
635 pc_factory_->CreateVideoSource(capturer, &native_constraints).get();
636 return source;
637 }
638
617 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { 639 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
618 DCHECK(!pc_factory_.get()); 640 DCHECK(!pc_factory_.get());
619 DCHECK(!audio_device_.get()); 641 DCHECK(!audio_device_.get());
620 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; 642 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()";
621 643
622 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; 644 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
623 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; 645 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
624 646
625 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 647 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
626 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = 648 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories =
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 if (!aec_dump_file_stream) { 1065 if (!aec_dump_file_stream) {
1044 VLOG(1) << "Could not open AEC dump file."; 1066 VLOG(1) << "Could not open AEC dump file.";
1045 base::ClosePlatformFile(aec_dump_file); 1067 base::ClosePlatformFile(aec_dump_file);
1046 } else { 1068 } else {
1047 // |pc_factory_| takes ownership of |aec_dump_file_stream|. 1069 // |pc_factory_| takes ownership of |aec_dump_file_stream|.
1048 pc_factory_->StartAecDump(aec_dump_file_stream); 1070 pc_factory_->StartAecDump(aec_dump_file_stream);
1049 } 1071 }
1050 } 1072 }
1051 1073
1052 } // namespace content 1074 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698