OLD | NEW |
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_CANVAS_CAPTURE_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |
6 #define CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | 6 #define CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "media/base/video_capturer_source.h" | 13 #include "media/base/video_capturer_source.h" |
14 #include "media/base/video_frame_pool.h" | 14 #include "media/base/video_frame_pool.h" |
15 #include "third_party/WebKit/public/platform/WebCanvasCaptureHandler.h" | 15 #include "third_party/WebKit/public/platform/WebCanvasCaptureHandler.h" |
16 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 16 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
17 #include "third_party/WebKit/public/platform/WebSize.h" | 17 #include "third_party/WebKit/public/platform/WebSize.h" |
18 #include "third_party/WebKit/public/platform/WebSkImage.h" | 18 #include "third_party/WebKit/public/platform/WebSkImage.h" |
19 #include "third_party/skia/include/core/SkImage.h" | 19 #include "third_party/skia/include/core/SkImage.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class CONTENT_EXPORT CanvasCaptureHandler final | 23 class CONTENT_EXPORT CanvasCaptureHandler final |
24 : public NON_EXPORTED_BASE(blink::WebCanvasCaptureHandler) { | 24 : public NON_EXPORTED_BASE(blink::WebCanvasCaptureHandler) { |
25 public: | 25 public: |
26 CanvasCaptureHandler(const blink::WebSize& size, | 26 CanvasCaptureHandler(const blink::WebSize& size, |
27 double frame_rate, | 27 double frame_rate, |
28 blink::WebMediaStream* stream); | 28 blink::WebMediaStream* stream); |
| 29 ~CanvasCaptureHandler() override; |
29 | 30 |
30 // blink::WebCanvasCaptureHandler Implementation. | 31 // blink::WebCanvasCaptureHandler Implementation. |
31 void sendNewFrame(const blink::WebSkImage& image) override; | 32 void sendNewFrame(const blink::WebSkImage& image) override; |
32 bool needsNewFrame() const override; | 33 bool needsNewFrame() const override; |
33 | 34 |
34 // Functions called by media::VideoCapturerSource implementation. | 35 // Functions called by media::VideoCapturerSource implementation. |
35 void StartVideoCapture( | 36 void StartVideoCapture( |
36 const media::VideoCaptureParams& params, | 37 const media::VideoCaptureParams& params, |
37 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& | 38 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& |
38 new_frame_callback, | 39 new_frame_callback, |
39 const media::VideoCapturerSource::RunningCallback& running_callback); | 40 const media::VideoCapturerSource::RunningCallback& running_callback); |
40 void StopVideoCapture(); | 41 void StopVideoCapture(); |
41 blink::WebSize GetSourceSize() const { return size_; } | 42 blink::WebSize GetSourceSize() const { return size_; } |
42 | 43 |
43 private: | 44 private: |
44 virtual ~CanvasCaptureHandler(); | |
45 | |
46 void CreateNewFrame(const blink::WebSkImage& image); | 45 void CreateNewFrame(const blink::WebSkImage& image); |
47 | 46 |
48 // Implementation VideoCapturerSource that is owned by blink and delegates | 47 // Implementation VideoCapturerSource that is owned by blink and delegates |
49 // the Start/Stop calls to CanvasCaptureHandler. | 48 // the Start/Stop calls to CanvasCaptureHandler. |
50 class VideoCapturerSource; | 49 class VideoCapturerSource; |
51 // Object that does all the work of running |new_frame_callback_|. | 50 // Object that does all the work of running |new_frame_callback_|. |
52 // Destroyed on |io_task_runner_| after the class is destroyed. | 51 // Destroyed on |io_task_runner_| after the class is destroyed. |
53 class CanvasCaptureHandlerDelegate; | 52 class CanvasCaptureHandlerDelegate; |
54 | 53 |
55 media::VideoCaptureFormat capture_format_; | 54 media::VideoCaptureFormat capture_format_; |
(...skipping 11 matching lines...) Expand all Loading... |
67 // Bound to the main render thread. | 66 // Bound to the main render thread. |
68 base::ThreadChecker thread_checker_; | 67 base::ThreadChecker thread_checker_; |
69 base::WeakPtrFactory<CanvasCaptureHandler> weak_ptr_factory_; | 68 base::WeakPtrFactory<CanvasCaptureHandler> weak_ptr_factory_; |
70 | 69 |
71 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); | 70 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); |
72 }; | 71 }; |
73 | 72 |
74 } // namespace content | 73 } // namespace content |
75 | 74 |
76 #endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | 75 #endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |
OLD | NEW |