• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/public/renderer/media_stream_video_sink.h"
6 
7 #include "base/logging.h"
8 #include "content/renderer/media/media_stream_video_track.h"
9 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
10 
11 namespace content {
12 
AddToVideoTrack(MediaStreamVideoSink * sink,const VideoCaptureDeliverFrameCB & callback,const blink::WebMediaStreamTrack & track)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* video_track =
19       static_cast<MediaStreamVideoTrack*>(track.extraData());
20   video_track->AddSink(sink, callback);
21 }
22 
RemoveFromVideoTrack(MediaStreamVideoSink * sink,const blink::WebMediaStreamTrack & track)23 void MediaStreamVideoSink::RemoveFromVideoTrack(
24     MediaStreamVideoSink* sink,
25     const blink::WebMediaStreamTrack& track) {
26   DCHECK_EQ(blink::WebMediaStreamSource::TypeVideo, track.source().type());
27   MediaStreamVideoTrack* video_track =
28       static_cast<MediaStreamVideoTrack*>(track.extraData());
29   video_track->RemoveSink(sink);
30 }
31 
32 }  // namespace content
33