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

Side by Side Diff: content/renderer/media_capture_from_element/html_video_element_capturer_source.h

Issue 2764633002: cc/paint: Remove cc::PaintSurface. (Closed)
Patch Set: fix for relanding Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CAPTURE_FROM_ELEMENT_HTML_VIDEO_ELEMENT_CAPTURER_ SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_CAPTURE_FROM_ELEMENT_HTML_VIDEO_ELEMENT_CAPTURER_ SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_CAPTURE_FROM_ELEMENT_HTML_VIDEO_ELEMENT_CAPTURER_ SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_CAPTURE_FROM_ELEMENT_HTML_VIDEO_ELEMENT_CAPTURER_ SOURCE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "cc/paint/paint_surface.h"
13 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
14 #include "media/base/video_frame_pool.h" 13 #include "media/base/video_frame_pool.h"
15 #include "media/base/video_types.h" 14 #include "media/base/video_types.h"
16 #include "media/capture/video_capturer_source.h" 15 #include "media/capture/video_capturer_source.h"
17 #include "third_party/WebKit/public/platform/WebSize.h" 16 #include "third_party/WebKit/public/platform/WebSize.h"
17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "third_party/skia/include/core/SkRefCnt.h" 18 #include "third_party/skia/include/core/SkRefCnt.h"
19 19
20 namespace base{ 20 namespace base{
21 class SingleThreadTaskRunner; 21 class SingleThreadTaskRunner;
22 } 22 }
23 23
24 namespace blink { 24 namespace blink {
25 class WebMediaPlayer; 25 class WebMediaPlayer;
26 } // namespace blink 26 } // namespace blink
27 27
28 namespace cc {
29 class PaintCanvas;
30 } // namespace cc
31
28 namespace content { 32 namespace content {
29 33
30 // This class is a VideoCapturerSource taking video snapshots of the ctor-passed 34 // This class is a VideoCapturerSource taking video snapshots of the ctor-passed
31 // blink::WebMediaPlayer on Render Main thread. The captured data is converted 35 // blink::WebMediaPlayer on Render Main thread. The captured data is converted
32 // and sent back to |io_task_runner_| via the registered |new_frame_callback_|. 36 // and sent back to |io_task_runner_| via the registered |new_frame_callback_|.
33 class CONTENT_EXPORT HtmlVideoElementCapturerSource final 37 class CONTENT_EXPORT HtmlVideoElementCapturerSource final
34 : public media::VideoCapturerSource { 38 : public media::VideoCapturerSource {
35 public: 39 public:
36 static std::unique_ptr<HtmlVideoElementCapturerSource> 40 static std::unique_ptr<HtmlVideoElementCapturerSource>
37 CreateFromWebMediaPlayerImpl( 41 CreateFromWebMediaPlayerImpl(
(...skipping 15 matching lines...) Expand all
53 const VideoCaptureDeliverFrameCB& new_frame_callback, 57 const VideoCaptureDeliverFrameCB& new_frame_callback,
54 const RunningCallback& running_callback) override; 58 const RunningCallback& running_callback) override;
55 void StopCapture() override; 59 void StopCapture() override;
56 60
57 private: 61 private:
58 // This method includes collecting data from the WebMediaPlayer and converting 62 // This method includes collecting data from the WebMediaPlayer and converting
59 // it into a format suitable for MediaStreams. 63 // it into a format suitable for MediaStreams.
60 void sendNewFrame(); 64 void sendNewFrame();
61 65
62 media::VideoFramePool frame_pool_; 66 media::VideoFramePool frame_pool_;
63 sk_sp<cc::PaintSurface> surface_; 67 SkBitmap bitmap_;
68 std::unique_ptr<cc::PaintCanvas> canvas_;
64 69
65 const base::WeakPtr<blink::WebMediaPlayer> web_media_player_; 70 const base::WeakPtr<blink::WebMediaPlayer> web_media_player_;
66 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 71 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
67 72
68 // These three configuration items are passed on StartCapture(); 73 // These three configuration items are passed on StartCapture();
69 RunningCallback running_callback_; 74 RunningCallback running_callback_;
70 VideoCaptureDeliverFrameCB new_frame_callback_; 75 VideoCaptureDeliverFrameCB new_frame_callback_;
71 double capture_frame_rate_; 76 double capture_frame_rate_;
72 77
73 // Target time for the next frame. 78 // Target time for the next frame.
74 base::TimeTicks next_capture_time_; 79 base::TimeTicks next_capture_time_;
75 80
76 // Bound to the main render thread. 81 // Bound to the main render thread.
77 base::ThreadChecker thread_checker_; 82 base::ThreadChecker thread_checker_;
78 83
79 // Used on main render thread to schedule future capture events. 84 // Used on main render thread to schedule future capture events.
80 base::WeakPtrFactory<HtmlVideoElementCapturerSource> weak_factory_; 85 base::WeakPtrFactory<HtmlVideoElementCapturerSource> weak_factory_;
81 86
82 DISALLOW_COPY_AND_ASSIGN(HtmlVideoElementCapturerSource); 87 DISALLOW_COPY_AND_ASSIGN(HtmlVideoElementCapturerSource);
83 }; 88 };
84 89
85 } // namespace content 90 } // namespace content
86 91
87 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_FROM_ELEMENT_HTML_VIDEO_ELEMENT_CAPTUR ER_SOURCE_H_ 92 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_FROM_ELEMENT_HTML_VIDEO_ELEMENT_CAPTUR ER_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698