2019-07-16 22:09:04 +02:00
|
|
|
#ifndef LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
#define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
|
2024-03-19 22:11:42 +01:00
|
|
|
#include <optional>
|
|
|
|
|
2023-01-30 18:43:54 +01:00
|
|
|
#include "base/functional/callback.h"
|
2019-07-16 22:09:04 +02:00
|
|
|
#include "components/viz/host/client_frame_sink_video_capturer.h"
|
2020-02-10 18:10:17 +01:00
|
|
|
#include "media/capture/mojom/video_capture_types.mojom.h"
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
class CefRenderWidgetHostViewOSR;
|
|
|
|
|
|
|
|
class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
|
|
|
public:
|
2024-03-08 13:44:56 +01:00
|
|
|
CefVideoConsumerOSR(CefRenderWidgetHostViewOSR* view,
|
|
|
|
bool use_shared_texture);
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefVideoConsumerOSR(const CefVideoConsumerOSR&) = delete;
|
|
|
|
CefVideoConsumerOSR& operator=(const CefVideoConsumerOSR&) = delete;
|
|
|
|
|
2019-07-16 22:09:04 +02:00
|
|
|
~CefVideoConsumerOSR() override;
|
|
|
|
|
|
|
|
void SetActive(bool active);
|
|
|
|
void SetFrameRate(base::TimeDelta frame_rate);
|
2020-01-31 23:54:26 +01:00
|
|
|
void SizeChanged(const gfx::Size& size_in_pixels);
|
2024-03-19 22:11:42 +01:00
|
|
|
void RequestRefreshFrame(const std::optional<gfx::Rect>& bounds_in_pixels);
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// viz::mojom::FrameSinkVideoConsumer implementation.
|
|
|
|
void OnFrameCaptured(
|
2021-12-16 23:35:54 +01:00
|
|
|
media::mojom::VideoBufferHandlePtr data,
|
|
|
|
media::mojom::VideoFrameInfoPtr info,
|
2019-07-16 22:09:04 +02:00
|
|
|
const gfx::Rect& content_rect,
|
2020-02-10 18:10:17 +01:00
|
|
|
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
|
|
|
callbacks) override;
|
2022-02-21 23:23:40 +01:00
|
|
|
void OnFrameWithEmptyRegionCapture() override {}
|
|
|
|
void OnStopped() override {}
|
|
|
|
void OnLog(const std::string& message) override {}
|
2023-11-21 20:17:55 +01:00
|
|
|
void OnNewSubCaptureTargetVersion(
|
|
|
|
uint32_t sub_capture_target_version) override {}
|
2019-07-16 22:09:04 +02:00
|
|
|
|
2024-03-08 13:44:56 +01:00
|
|
|
const bool use_shared_texture_;
|
|
|
|
|
2019-07-16 22:09:04 +02:00
|
|
|
CefRenderWidgetHostViewOSR* const view_;
|
|
|
|
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
gfx::Size size_in_pixels_;
|
2024-03-19 22:11:42 +01:00
|
|
|
std::optional<gfx::Rect> bounds_in_pixels_;
|
2019-07-16 22:09:04 +02:00
|
|
|
};
|
|
|
|
|
2023-11-21 20:17:55 +01:00
|
|
|
#endif // LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|