|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_RENDERER_MEDIA_LOCAL_VIDEO_RENDER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_LOCAL_VIDEO_RENDER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "content/common/content_export.h" | |
10 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | |
11 #include "ui/gfx/size.h" | |
12 #include "webkit/media/video_frame_provider.h" | |
13 | |
14 namespace base { | |
15 class MessageLoopProxy; | |
16 } | |
17 | |
18 // RTCVideoRender is a webkit_media::VideoFrameProvider designed for rendering | |
19 // Video MediaStreamTracks, | |
20 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack | |
21 // RTCVideoRender implements webrtc::VideoRendererInterface in order to render | |
22 // video frames provided from a webrtc::VideoTrackInteface. | |
23 // RTCVideoRender register itself to the Video Track when the | |
24 // VideoFrameProvider is started and deregisters itself when it is stopped. | |
25 // Calls to webrtc::VideoTrackInterface must occur in the main thread. | |
26 class CONTENT_EXPORT RTCVideoRender | |
scherkus (not reviewing)
2012/09/07 11:44:03
Shouldn't this be RTCVideoRenderer (extra "er" on
wjia(left Chromium)
2012/09/13 01:22:07
Done.
| |
27 : NON_EXPORTED_BASE(public webkit_media::VideoFrameProvider), | |
28 NON_EXPORTED_BASE(public webrtc::VideoRendererInterface) { | |
29 public: | |
30 RTCVideoRender( | |
31 webrtc::VideoTrackInterface* video_track, | |
32 const base::Closure& error_cb, | |
33 const webkit_media::RepaintCB& repaint_cb); | |
34 | |
35 // webkit_media::VideoFrameProvider implementation. Called in the main thread. | |
scherkus (not reviewing)
2012/09/07 11:44:03
s/in/on/
wjia(left Chromium)
2012/09/13 01:22:07
Done.
| |
36 virtual void Start() OVERRIDE; | |
37 virtual void Stop() OVERRIDE; | |
38 virtual void Play() OVERRIDE; | |
39 virtual void Pause() OVERRIDE; | |
40 | |
41 // webrtc::VideoRendererInterface implementation. May be called in | |
scherkus (not reviewing)
2012/09/07 11:44:03
s/in/on/
wjia(left Chromium)
2012/09/13 01:22:07
Done.
| |
42 // a different thread. | |
43 virtual void SetSize(int width, int height) OVERRIDE; | |
44 virtual void RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; | |
45 | |
46 protected: | |
47 virtual ~RTCVideoRender(); | |
48 | |
49 private: | |
50 enum ProviderState { | |
scherkus (not reviewing)
2012/09/07 11:44:03
s/ProviderState/State/?
wjia(left Chromium)
2012/09/13 01:22:07
Done.
| |
51 kStarted, | |
52 kPaused, | |
53 kStopped, | |
54 }; | |
55 | |
56 void DoRenderFrameOnMainThread(scoped_refptr<media::VideoFrame> video_frame); | |
57 | |
58 base::Closure error_cb_; | |
59 webkit_media::RepaintCB repaint_cb_; | |
60 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | |
61 ProviderState state_; | |
62 | |
63 // The video track the renderer is connected to. | |
64 scoped_refptr<webrtc::VideoTrackInterface> video_track_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(RTCVideoRender); | |
67 }; | |
68 | |
69 #endif // CONTENT_RENDERER_MEDIA_LOCAL_VIDEO_RENDER_H_ | |
OLD | NEW |