Chromium Code Reviews| Index: content/renderer/media/video_track.cc |
| diff --git a/content/renderer/media/video_track.cc b/content/renderer/media/video_track.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..eb7e0c1256b2879187e6b5e6014a1a0b46156a9b |
| --- /dev/null |
| +++ b/content/renderer/media/video_track.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/renderer/media/video_track.h" |
| + |
| +#include "content/renderer/media/webrtc_videosink_adapter.h" |
| + |
| +namespace content { |
| + |
| +VideoTrack::VideoTrack(webrtc::VideoTrackInterface* track) |
| + : MediaStreamTrackExtraData(track), |
| + video_track_(track) { |
| +} |
| + |
| +VideoTrack::~VideoTrack() { |
| + DCHECK(sinks_.empty()); |
| +} |
| + |
| +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.
|
| + sinks_.push_back(new WebRtcVideoSinkAdapter(video_track_, sink)); |
| +} |
| + |
| +void VideoTrack::UnRegisterSink(VideoTrackSink* sink) { |
| + bool sink_found = false; |
| + 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.
|
| + it != sinks_.end(); ++it) { |
| + if ((*it)->sink() == sink) { |
| + sinks_.erase(it); |
| + sink_found = true; |
| + break; |
| + } |
| + } |
| + DCHECK(sink_found); |
| +} |
| + |
| +} // namespace content |