mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-12 17:46:04 +01:00
8c6cc302d0
This includes the following changes: - Update usage of surface IDs to match the Aura implementation from the RWHVAura/Window classes. - Batch CefBrowserHost::WasResized calls to avoid excessive/unnecessary calls to SynchronizeVisualProperties. - Cache the results of CefRenderHandler::GetViewRect after resize and make RWHVOSR::GetViewBounds the source of truth for all size calculations. - Fix bounds calculations in CefVideoConsumerOSR with GPU enabled. Known issues: - The size passed to OnPaint may be off by 1 pixel in cases where the device scale factor is not 1 and does not divide evenly into the pixel size. This is due to the inexact conversion from integer pixel size to integer logical size for GetViewRect.
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#ifndef LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
#define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
#include "base/callback.h"
|
|
#include "base/optional.h"
|
|
#include "components/viz/host/client_frame_sink_video_capturer.h"
|
|
#include "media/capture/mojom/video_capture_types.mojom.h"
|
|
|
|
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);
|
|
void SizeChanged(const gfx::Size& size_in_pixels);
|
|
void RequestRefreshFrame(const base::Optional<gfx::Rect>& bounds_in_pixels);
|
|
|
|
private:
|
|
// viz::mojom::FrameSinkVideoConsumer implementation.
|
|
void OnFrameCaptured(
|
|
base::ReadOnlySharedMemoryRegion data,
|
|
::media::mojom::VideoFrameInfoPtr info,
|
|
const gfx::Rect& content_rect,
|
|
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
|
callbacks) override;
|
|
void OnStopped() override;
|
|
|
|
CefRenderWidgetHostViewOSR* const view_;
|
|
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
|
|
|
gfx::Size size_in_pixels_;
|
|
base::Optional<gfx::Rect> bounds_in_pixels_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefVideoConsumerOSR);
|
|
};
|
|
|
|
#endif // LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|