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

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

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

Powered by Google App Engine
This is Rietveld 408576698