Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Side by Side Diff: content/public/renderer/media_stream_video_sink.h

Issue 264363005: Cast: deliver video frames on the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ThreadCheckerImpl Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ 5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ 6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
7 7
8 #include "base/callback.h"
8 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "content/public/renderer/media_stream_sink.h" 12 #include "content/public/renderer/media_stream_sink.h"
12 13
13 namespace media { 14 namespace media {
15 class VideoCaptureFormat;
14 class VideoFrame; 16 class VideoFrame;
15 } 17 }
16 18
17 namespace blink { 19 namespace blink {
18 class WebMediaStreamTrack; 20 class WebMediaStreamTrack;
19 } 21 }
20 22
21 namespace content { 23 namespace content {
22 24
25 typedef base::Callback<
26 void(const scoped_refptr<media::VideoFrame>&,
27 const media::VideoCaptureFormat&)>
28 VideoSinkDeliverFrameCB;
29
23 // MediaStreamVideoSink is an interface used for receiving video frames from a 30 // MediaStreamVideoSink is an interface used for receiving video frames from a
24 // Video Stream Track or a Video Source. 31 // Video Stream Track or a Video Source.
25 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html 32 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html
26 // All methods calls will be done from the main render thread. 33 // All methods calls will be done from the main render thread.
27 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink { 34 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink {
28 public: 35 public:
29 // An implementation of MediaStreamVideoSink should call AddToVideoTrack when 36 // An implementation of MediaStreamVideoSink should call AddToVideoTrack when
30 // it is ready to receive data from a video track. Before the implementation 37 // it is ready to receive data from a video track. Before the implementation
31 // is destroyed, RemoveFromVideoTrack must be called. 38 // is destroyed, RemoveFromVideoTrack must be called.
39 //
32 // Calls to these methods must be done on the main render thread. 40 // Calls to these methods must be done on the main render thread.
41 // Note that |callback| for frame delivery happens on the IO thread.
42 //
43 // Calling RemoveFromVideoTrack also not stop frame delivery through the
44 // callback immediately because it may happen on another thread.
45 // The added callback will be reset on the render thread.
33 static void AddToVideoTrack(MediaStreamVideoSink* sink, 46 static void AddToVideoTrack(MediaStreamVideoSink* sink,
47 const VideoSinkDeliverFrameCB& callback,
34 const blink::WebMediaStreamTrack& track); 48 const blink::WebMediaStreamTrack& track);
35 static void RemoveFromVideoTrack(MediaStreamVideoSink* sink, 49 static void RemoveFromVideoTrack(MediaStreamVideoSink* sink,
36 const blink::WebMediaStreamTrack& track); 50 const blink::WebMediaStreamTrack& track);
37 51
38 virtual void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame) = 0;
39
40 protected: 52 protected:
41 virtual ~MediaStreamVideoSink() {} 53 virtual ~MediaStreamVideoSink() {}
42 }; 54 };
43 55
44 56
45 } // namespace content 57 } // namespace content
46 58
47 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ 59 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | content/public/renderer/media_stream_video_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698