• 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 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
7 
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h"
11 #include "content/public/renderer/media_stream_sink.h"
12 
13 namespace media {
14 class VideoFrame;
15 }
16 
17 namespace blink {
18 class WebMediaStreamTrack;
19 }
20 
21 namespace content {
22 
23 // MediaStreamVideoSink is an interface used for receiving video frames from a
24 // Video Stream Track or a Video Source.
25 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html
26 // All methods calls will be done from the main render thread.
27 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink {
28  public:
29   // An implementation of MediaStreamVideoSink should call AddToVideoTrack when
30   // it is ready to receive data from a video track. Before the implementation
31   // is destroyed, RemoveFromVideoTrack must be called.
32   // Calls to these methods must be done on the main render thread.
33   static void AddToVideoTrack(MediaStreamVideoSink* sink,
34                               const blink::WebMediaStreamTrack& track);
35   static void RemoveFromVideoTrack(MediaStreamVideoSink* sink,
36                                    const blink::WebMediaStreamTrack& track);
37 
38   virtual void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame) = 0;
39 
40  protected:
~MediaStreamVideoSink()41   virtual ~MediaStreamVideoSink() {}
42 };
43 
44 
45 }  // namespace content
46 
47 #endif  // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
48