Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/media/video_track.h" | |
| 6 | |
| 7 #include "content/renderer/media/webrtc_videosink_adapter.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 VideoTrack::VideoTrack(webrtc::VideoTrackInterface* track) | |
| 12 : MediaStreamTrackExtraData(track), | |
| 13 video_track_(track) { | |
| 14 } | |
| 15 | |
| 16 VideoTrack::~VideoTrack() { | |
| 17 DCHECK(sinks_.empty()); | |
| 18 } | |
| 19 | |
| 20 void VideoTrack::RegisterSink(VideoTrackSink* sink) { | |
|
no longer working on chromium
2013/11/25 13:55:07
add thread check to make sure the methods are thre
perkj_chrome
2013/11/26 09:16:38
Done.
| |
| 21 sinks_.push_back(new WebRtcVideoSinkAdapter(video_track_, sink)); | |
| 22 } | |
| 23 | |
| 24 void VideoTrack::UnRegisterSink(VideoTrackSink* sink) { | |
| 25 bool sink_found = false; | |
| 26 for (ScopedVector<WebRtcVideoSinkAdapter>::iterator it = sinks_.begin(); | |
|
no longer working on chromium
2013/11/25 13:55:07
you can use std::find_if if you wrap the compariso
perkj_chrome
2013/11/26 09:16:38
Done.
| |
| 27 it != sinks_.end(); ++it) { | |
| 28 if ((*it)->sink() == sink) { | |
| 29 sinks_.erase(it); | |
| 30 sink_found = true; | |
| 31 break; | |
| 32 } | |
| 33 } | |
| 34 DCHECK(sink_found); | |
| 35 } | |
| 36 | |
| 37 } // namespace content | |
| OLD | NEW |