Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / renderer / media_stream_video_sink.h
blob04fba9298e39a6f6ec43bf1ef654ba9eec6425f3
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 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
12 #include "content/common/content_export.h"
13 #include "content/public/renderer/media_stream_sink.h"
14 #include "media/base/video_capturer_source.h"
16 namespace blink {
17 class WebMediaStreamTrack;
20 namespace content {
22 typedef media::VideoCapturerSource::VideoCaptureDeliverFrameCB
23 VideoCaptureDeliverFrameCB;
25 // MediaStreamVideoSink is an interface used for receiving video frames from a
26 // Video Stream Track or a Video Source.
27 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html
28 // All methods calls will be done from the main render thread.
29 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink {
30 public:
31 // An implementation of MediaStreamVideoSink should call AddToVideoTrack when
32 // it is ready to receive data from a video track. Before the implementation
33 // is destroyed, RemoveFromVideoTrack must be called.
35 // Calls to these methods must be done on the main render thread.
36 // Note that |callback| for frame delivery happens on the IO thread.
38 // Calling RemoveFromVideoTrack also not stop frame delivery through the
39 // callback immediately because it may happen on another thread.
40 // The added callback will be reset on the render thread.
41 static void AddToVideoTrack(MediaStreamVideoSink* sink,
42 const VideoCaptureDeliverFrameCB& callback,
43 const blink::WebMediaStreamTrack& track);
44 static void RemoveFromVideoTrack(MediaStreamVideoSink* sink,
45 const blink::WebMediaStreamTrack& track);
47 protected:
48 ~MediaStreamVideoSink() override {}
52 } // namespace content
54 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_