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.
5 #include "content/public/renderer/media_stream_video_sink.h"
7 #include "base/logging.h"
8 #include "content/renderer/media/media_stream_video_track.h"
9 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
13 void MediaStreamVideoSink::AddToVideoTrack(
14 MediaStreamVideoSink
* sink
,
15 const VideoCaptureDeliverFrameCB
& callback
,
16 const blink::WebMediaStreamTrack
& track
) {
17 DCHECK_EQ(blink::WebMediaStreamSource::TypeVideo
, track
.source().type());
18 MediaStreamVideoTrack
* const video_track
=
19 static_cast<MediaStreamVideoTrack
*>(track
.extraData());
20 video_track
->AddSink(sink
, callback
);
23 void MediaStreamVideoSink::RemoveFromVideoTrack(
24 MediaStreamVideoSink
* sink
,
25 const blink::WebMediaStreamTrack
& track
) {
26 DCHECK_EQ(blink::WebMediaStreamSource::TypeVideo
, track
.source().type());
27 MediaStreamVideoTrack
* const video_track
=
28 static_cast<MediaStreamVideoTrack
*>(track
.extraData());
29 video_track
->RemoveSink(sink
);
32 } // namespace content