2019-07-16 22:09:04 +02:00
|
|
|
#ifndef LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
#define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
|
|
|
|
#include "base/callback.h"
|
2020-01-31 23:54:26 +01:00
|
|
|
#include "base/optional.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:
|
|
|
|
explicit CefVideoConsumerOSR(CefRenderWidgetHostViewOSR* view);
|
|
|
|
~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);
|
|
|
|
void RequestRefreshFrame(const base::Optional<gfx::Rect>& bounds_in_pixels);
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// viz::mojom::FrameSinkVideoConsumer implementation.
|
|
|
|
void OnFrameCaptured(
|
|
|
|
base::ReadOnlySharedMemoryRegion data,
|
|
|
|
::media::mojom::VideoFrameInfoPtr info,
|
|
|
|
const gfx::Rect& content_rect,
|
2020-02-10 18:10:17 +01:00
|
|
|
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
|
|
|
callbacks) override;
|
2019-07-16 22:09:04 +02:00
|
|
|
void OnStopped() override;
|
2020-06-09 19:48:00 +02:00
|
|
|
void OnLog(const std::string& message) override;
|
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_;
|
|
|
|
base::Optional<gfx::Rect> bounds_in_pixels_;
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefVideoConsumerOSR);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|