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