• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
2 #define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
3 
4 #include "base/callback.h"
5 #include "components/viz/host/client_frame_sink_video_capturer.h"
6 #include "media/capture/mojom/video_capture_types.mojom.h"
7 #include "third_party/abseil-cpp/absl/types/optional.h"
8 
9 class CefRenderWidgetHostViewOSR;
10 
11 class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
12  public:
13   explicit CefVideoConsumerOSR(CefRenderWidgetHostViewOSR* view);
14 
15   CefVideoConsumerOSR(const CefVideoConsumerOSR&) = delete;
16   CefVideoConsumerOSR& operator=(const CefVideoConsumerOSR&) = delete;
17 
18   ~CefVideoConsumerOSR() override;
19 
20   void SetActive(bool active);
21   void SetFrameRate(base::TimeDelta frame_rate);
22   void SizeChanged(const gfx::Size& size_in_pixels);
23   void RequestRefreshFrame(const absl::optional<gfx::Rect>& bounds_in_pixels);
24 
25  private:
26   // viz::mojom::FrameSinkVideoConsumer implementation.
27   void OnFrameCaptured(
28       media::mojom::VideoBufferHandlePtr data,
29       media::mojom::VideoFrameInfoPtr info,
30       const gfx::Rect& content_rect,
31       mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
32           callbacks) override;
33   void OnStopped() override;
34   void OnLog(const std::string& message) override;
35 
36   CefRenderWidgetHostViewOSR* const view_;
37   std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
38 
39   gfx::Size size_in_pixels_;
40   absl::optional<gfx::Rect> bounds_in_pixels_;
41 };
42 
43 #endif  // LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_