| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // blink::WebCanvasCaptureHandler Implementation. | 46 // blink::WebCanvasCaptureHandler Implementation. |
| 47 void sendNewFrame(const SkImage* image) override; | 47 void sendNewFrame(const SkImage* image) override; |
| 48 bool needsNewFrame() const override; | 48 bool needsNewFrame() const override; |
| 49 | 49 |
| 50 // Functions called by media::VideoCapturerSource implementation. | 50 // Functions called by media::VideoCapturerSource implementation. |
| 51 void StartVideoCapture( | 51 void StartVideoCapture( |
| 52 const media::VideoCaptureParams& params, | 52 const media::VideoCaptureParams& params, |
| 53 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& | 53 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& |
| 54 new_frame_callback, | 54 new_frame_callback, |
| 55 const media::VideoCapturerSource::RunningCallback& running_callback); | 55 const media::VideoCapturerSource::RunningCallback& running_callback); |
| 56 void RequestRefreshFrame(); |
| 56 void StopVideoCapture(); | 57 void StopVideoCapture(); |
| 57 blink::WebSize GetSourceSize() const { return size_; } | 58 blink::WebSize GetSourceSize() const { return size_; } |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 // A VideoCapturerSource instance is created, which is responsible for handing | 61 // A VideoCapturerSource instance is created, which is responsible for handing |
| 61 // stop&start callbacks back to CanvasCaptureHandler. That VideoCapturerSource | 62 // stop&start callbacks back to CanvasCaptureHandler. That VideoCapturerSource |
| 62 // is then plugged into a MediaStreamTrack passed as |track|, and it is owned | 63 // is then plugged into a MediaStreamTrack passed as |track|, and it is owned |
| 63 // by the Blink side MediaStreamSource. | 64 // by the Blink side MediaStreamSource. |
| 64 CanvasCaptureHandler( | 65 CanvasCaptureHandler( |
| 65 const blink::WebSize& size, | 66 const blink::WebSize& size, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 media::VideoCaptureFormat capture_format_; | 80 media::VideoCaptureFormat capture_format_; |
| 80 bool ask_for_new_frame_; | 81 bool ask_for_new_frame_; |
| 81 | 82 |
| 82 const blink::WebSize size_; | 83 const blink::WebSize size_; |
| 83 gfx::Size last_size; | 84 gfx::Size last_size; |
| 84 std::vector<uint8_t> temp_data_; | 85 std::vector<uint8_t> temp_data_; |
| 85 size_t row_bytes_; | 86 size_t row_bytes_; |
| 86 SkImageInfo image_info_; | 87 SkImageInfo image_info_; |
| 87 media::VideoFramePool frame_pool_; | 88 media::VideoFramePool frame_pool_; |
| 88 | 89 |
| 90 scoped_refptr<media::VideoFrame> last_frame_; |
| 91 |
| 89 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 92 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 90 scoped_ptr<CanvasCaptureHandlerDelegate> delegate_; | 93 scoped_ptr<CanvasCaptureHandlerDelegate> delegate_; |
| 91 | 94 |
| 92 // Bound to Main Render thread. | 95 // Bound to Main Render thread. |
| 93 base::ThreadChecker main_render_thread_checker_; | 96 base::ThreadChecker main_render_thread_checker_; |
| 94 base::WeakPtrFactory<CanvasCaptureHandler> weak_ptr_factory_; | 97 base::WeakPtrFactory<CanvasCaptureHandler> weak_ptr_factory_; |
| 95 | 98 |
| 96 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); | 99 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); |
| 97 }; | 100 }; |
| 98 | 101 |
| 99 } // namespace content | 102 } // namespace content |
| 100 | 103 |
| 101 #endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | 104 #endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |
| OLD | NEW |