OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_MEDIA_RTC_VIDEO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_RENDERER_H_ |
6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_RENDERER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/media/video_capture.h" |
10 #include "content/public/renderer/media_stream_video_sink.h" | 12 #include "content/public/renderer/media_stream_video_sink.h" |
11 #include "content/renderer/media/video_frame_provider.h" | 13 #include "content/renderer/media/video_frame_provider.h" |
12 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
13 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 class MessageLoopProxy; | 18 class MessageLoopProxy; |
17 } | 19 } |
18 | 20 |
19 namespace content { | 21 namespace content { |
(...skipping 25 matching lines...) Expand all Loading... |
45 protected: | 47 protected: |
46 virtual ~RTCVideoRenderer(); | 48 virtual ~RTCVideoRenderer(); |
47 | 49 |
48 private: | 50 private: |
49 enum State { | 51 enum State { |
50 STARTED, | 52 STARTED, |
51 PAUSED, | 53 PAUSED, |
52 STOPPED, | 54 STOPPED, |
53 }; | 55 }; |
54 | 56 |
| 57 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame, |
| 58 const media::VideoCaptureFormat& format); |
| 59 |
55 // VideoTrackSink implementation. Called on the main thread. | 60 // VideoTrackSink implementation. Called on the main thread. |
56 virtual void OnVideoFrame( | |
57 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE; | |
58 virtual void OnReadyStateChanged( | 61 virtual void OnReadyStateChanged( |
59 blink::WebMediaStreamSource::ReadyState state) OVERRIDE; | 62 blink::WebMediaStreamSource::ReadyState state) OVERRIDE; |
60 virtual void OnEnabledChanged(bool enabled) OVERRIDE; | 63 virtual void OnEnabledChanged(bool enabled) OVERRIDE; |
61 | 64 |
62 void RenderSignalingFrame(); | 65 void RenderSignalingFrame(); |
63 | 66 |
64 base::Closure error_cb_; | 67 base::Closure error_cb_; |
65 RepaintCB repaint_cb_; | 68 RepaintCB repaint_cb_; |
66 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 69 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
67 State state_; | 70 State state_; |
68 gfx::Size frame_size_; | 71 gfx::Size frame_size_; |
69 blink::WebMediaStreamTrack video_track_; | 72 blink::WebMediaStreamTrack video_track_; |
| 73 base::WeakPtrFactory<RTCVideoRenderer> weak_factory_; |
70 | 74 |
71 DISALLOW_COPY_AND_ASSIGN(RTCVideoRenderer); | 75 DISALLOW_COPY_AND_ASSIGN(RTCVideoRenderer); |
72 }; | 76 }; |
73 | 77 |
74 } // namespace content | 78 } // namespace content |
75 | 79 |
76 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_RENDERER_H_ | 80 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_RENDERER_H_ |
OLD | NEW |