OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/threading/thread.h" | |
12 #include "base/threading/thread_checker.h" | |
13 #include "content/common/content_export.h" | |
14 #include "media/base/video_capturer_source.h" | |
15 #include "media/base/video_frame_pool.h" | |
16 #include "media/base/video_types.h" | |
17 #include "third_party/WebKit/public/platform/WebCanvasCaptureHandler.h" | |
18 #include "third_party/WebKit/public/platform/WebMediaStream.h" | |
19 #include "third_party/WebKit/public/platform/WebSize.h" | |
20 #include "third_party/WebKit/public/platform/WebSkImage.h" | |
21 #include "third_party/skia/include/core/SkImage.h" | |
22 | |
23 namespace content { | |
24 | |
25 class CONTENT_EXPORT CanvasCaptureHandler final | |
26 : public NON_EXPORTED_BASE(blink::WebCanvasCaptureHandler), | |
27 public base::RefCounted<CanvasCaptureHandler> { | |
perkj_chrome
2015/11/26 18:52:14
RefCounted? Does this object really need to be? It
emircan
2015/12/01 00:25:45
Here is my logic. I am not sure if I am doing the
| |
28 public: | |
29 CanvasCaptureHandler(const blink::WebSize& size, | |
30 blink::WebMediaStream* stream); | |
31 | |
32 // blink::WebCanvasCaptureHandler Implementation. | |
33 void sendNewFrame(const blink::WebSkImage& image) override; | |
34 bool needsNewFrameCapture() const override; | |
35 | |
36 // media::VideoCapturerSource Implementation. | |
perkj_chrome
2015/11/26 18:52:14
This class does not implement media::VideoCapturer
emircan
2015/12/01 00:25:45
Leftover from earlier. Fixing it.
| |
37 void StartVideoCapture( | |
38 const media::VideoCaptureParams& params, | |
39 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& | |
40 new_frame_callback, | |
41 const media::VideoCapturerSource::RunningCallback& running_callback); | |
42 void StopVideoCapture(); | |
43 blink::WebSize GetSourceSize() { return size_; } | |
44 | |
45 private: | |
46 friend class base::RefCounted<CanvasCaptureHandler>; | |
47 virtual ~CanvasCaptureHandler(); | |
48 | |
49 class VideoCapturerSource; | |
50 // An object that does all the work of running |new_frame_callback_|. | |
51 // Destroyed on |io_task_runner_| after the class is destroyed. | |
52 class CanvasCaptureHandlerDelegate; | |
53 scoped_ptr<CanvasCaptureHandlerDelegate> delegate_; | |
54 void createNewFrame(const blink::WebSkImage& image); | |
55 | |
56 media::VideoCaptureFormat capture_format_; | |
57 bool ask_for_new_frame_; | |
58 | |
59 const blink::WebSize size_; | |
60 gfx::Size last_size; | |
61 std::vector<uint8> temp_data_; | |
62 size_t row_bytes_; | |
63 SkImageInfo image_info_; | |
64 media::VideoFramePool frame_pool_; | |
65 | |
66 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
67 // Bound to the main render thread. | |
68 base::ThreadChecker thread_checker_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); | |
71 }; | |
72 | |
73 } // namespace content | |
74 | |
75 #endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | |
OLD | NEW |