| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "content/common/media/video_capture.h" | 12 #include "content/common/media/video_capture.h" |
| 13 #include "content/public/renderer/render_frame_observer.h" |
| 13 #include "content/renderer/media/media_stream_video_source.h" | 14 #include "content/renderer/media/media_stream_video_source.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 class VideoCapturerSource; | 17 class VideoCapturerSource; |
| 17 } // namespace media | 18 } // namespace media |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // Representation of a video stream coming from a camera, owned by Blink as | 22 // Representation of a video stream coming from a camera, owned by Blink as |
| 22 // WebMediaStreamSource. Objects of this class are created and live on main | 23 // WebMediaStreamSource. Objects of this class are created and live on main |
| 23 // Render thread. Objects can be constructed either by indicating a |device| to | 24 // Render thread. Objects can be constructed either by indicating a |device| to |
| 24 // look for, or by plugging in a |source| constructed elsewhere. | 25 // look for, or by plugging in a |source| constructed elsewhere. |
| 25 class CONTENT_EXPORT MediaStreamVideoCapturerSource | 26 class CONTENT_EXPORT MediaStreamVideoCapturerSource |
| 26 : public MediaStreamVideoSource { | 27 : public MediaStreamVideoSource, |
| 28 public RenderFrameObserver { |
| 27 public: | 29 public: |
| 28 MediaStreamVideoCapturerSource( | 30 MediaStreamVideoCapturerSource( |
| 29 const SourceStoppedCallback& stop_callback, | 31 const SourceStoppedCallback& stop_callback, |
| 30 std::unique_ptr<media::VideoCapturerSource> source); | 32 std::unique_ptr<media::VideoCapturerSource> source); |
| 31 MediaStreamVideoCapturerSource(const SourceStoppedCallback& stop_callback, | 33 MediaStreamVideoCapturerSource(const SourceStoppedCallback& stop_callback, |
| 32 const StreamDeviceInfo& device_info); | 34 const StreamDeviceInfo& device_info, |
| 35 RenderFrame* render_frame); |
| 33 ~MediaStreamVideoCapturerSource() override; | 36 ~MediaStreamVideoCapturerSource() override; |
| 34 | 37 |
| 35 // Implements MediaStreamVideoSource. | 38 // Implements MediaStreamVideoSource. |
| 36 void RequestRefreshFrame() override; | 39 void RequestRefreshFrame() override; |
| 37 | 40 |
| 41 void SetCapturingLinkSecured(bool is_secure) override; |
| 42 |
| 38 private: | 43 private: |
| 39 friend class CanvasCaptureHandlerTest; | 44 friend class CanvasCaptureHandlerTest; |
| 40 friend class MediaStreamVideoCapturerSourceTest; | 45 friend class MediaStreamVideoCapturerSourceTest; |
| 41 | 46 |
| 42 // Implements MediaStreamVideoSource. | 47 // Implements MediaStreamVideoSource. |
| 43 void GetCurrentSupportedFormats( | 48 void GetCurrentSupportedFormats( |
| 44 int max_requested_width, | 49 int max_requested_width, |
| 45 int max_requested_height, | 50 int max_requested_height, |
| 46 double max_requested_frame_rate, | 51 double max_requested_frame_rate, |
| 47 const VideoCaptureDeviceFormatsCB& callback) override; | 52 const VideoCaptureDeviceFormatsCB& callback) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 | 63 |
| 59 // The source that provides video frames. | 64 // The source that provides video frames. |
| 60 const std::unique_ptr<media::VideoCapturerSource> source_; | 65 const std::unique_ptr<media::VideoCapturerSource> source_; |
| 61 | 66 |
| 62 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); | 67 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 } // namespace content | 70 } // namespace content |
| 66 | 71 |
| 67 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 72 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| OLD | NEW |