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

Side by Side Diff: content/renderer/media/media_stream_video_source.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_video_source.h" 5 #include "content/renderer/media/media_stream_video_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/renderer/media_stream_video_sink.h" 8 #include "content/public/renderer/media_stream_video_sink.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 MediaStreamVideoSource::MediaStreamVideoSource()
13 : factory_(NULL) {}
14
12 void MediaStreamVideoSource::AddTrack( 15 void MediaStreamVideoSource::AddTrack(
13 const blink::WebMediaStreamTrack& track, 16 const blink::WebMediaStreamTrack& track,
Peng 2014/01/09 15:32:55 If the video track has been connected to a video s
Ronghua Wu (Left Chromium) 2014/01/09 16:50:06 I've not decided yet. Open to suggestion. Either t
Peng 2014/01/09 19:29:46 IMHO, supporting changing video source in a track
14 const blink::WebMediaConstraints& constraints) { 17 const blink::WebMediaConstraints& constraints) {
Peng 2014/01/09 15:32:55 Does it allow adding a track more than once? maybe
Ronghua Wu (Left Chromium) 2014/01/09 16:50:06 A track can update its constraints. So I think wha
15 // TODO(ronghuawu): Put |track| in the registered tracks list. Will later 18 WebRtcVideoSourceAdapter* adapter =
16 // deliver frames to it according to |constraints|. 19 new WebRtcVideoSourceAdapter(track, constraints, factory_);
20 if (!adapter->Init()) {
21 return;
22 }
23 adapters_.push_back(adapter);
17 } 24 }
18 25
19 void MediaStreamVideoSource::RemoveTrack( 26 void MediaStreamVideoSource::RemoveTrack(
20 const blink::WebMediaStreamTrack& track) { 27 const blink::WebMediaStreamTrack& track) {
21 // TODO(ronghuawu): Remove |track| from the list, i.e. will stop delivering 28 for (WebRtcVideoSourceAdapters::iterator iter = adapters_.begin();
22 // frame to |track|. 29 iter != adapters_.end(); ++iter) {
30 if (track.id() == (*iter)->track().id()) {
31 adapters_.erase(iter);
32 break;
33 }
34 }
23 } 35 }
24 36
25 void MediaStreamVideoSource::SetReadyState( 37 void MediaStreamVideoSource::SetReadyState(
26 blink::WebMediaStreamSource::ReadyState state) { 38 blink::WebMediaStreamSource::ReadyState state) {
27 // TODO(ronghuawu): Sets WebMediaStreamSource's ready state and notifies the 39 // TODO(ronghuawu): Sets WebMediaStreamSource's ready state and notifies the
28 // ready state to all registered tracks. 40 // ready state to all registered tracks.
29 } 41 }
30 42
31 void MediaStreamVideoSource::DeliverVideoFrame( 43 void MediaStreamVideoSource::DeliverVideoFrame(
32 const scoped_refptr<media::VideoFrame>& frame) { 44 const scoped_refptr<media::VideoFrame>& frame) {
33 // TODO(ronghuawu): Deliver |frame| to all the registered tracks. 45 // TODO(ronghuawu): Deliver |frame| to all the registered tracks.
34 } 46 }
35 47
36 MediaStreamVideoSource::~MediaStreamVideoSource() { 48 MediaStreamVideoSource::~MediaStreamVideoSource() {
49 for (WebRtcVideoSourceAdapters::iterator iter = adapters_.begin();
50 iter != adapters_.end(); ++iter) {
51 delete *iter;
52 }
53 }
54
55 void MediaStreamVideoSource::SetMsFactory(
56 MediaStreamDependencyFactory* factory) {
57 factory_ = factory;
37 } 58 }
38 59
39 } // namespace content 60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698