mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
 | |
| #define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
 | |
| 
 | |
| #include <optional>
 | |
| 
 | |
| #include "base/functional/callback.h"
 | |
| #include "base/memory/raw_ptr.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:
 | |
|   CefVideoConsumerOSR(CefRenderWidgetHostViewOSR* view,
 | |
|                       bool use_shared_texture);
 | |
| 
 | |
|   CefVideoConsumerOSR(const CefVideoConsumerOSR&) = delete;
 | |
|   CefVideoConsumerOSR& operator=(const CefVideoConsumerOSR&) = delete;
 | |
| 
 | |
|   ~CefVideoConsumerOSR() override;
 | |
| 
 | |
|   void SetActive(bool active);
 | |
|   void SetFrameRate(base::TimeDelta frame_rate);
 | |
|   void SizeChanged(const gfx::Size& size_in_pixels);
 | |
|   void RequestRefreshFrame(const std::optional<gfx::Rect>& bounds_in_pixels);
 | |
| 
 | |
|  private:
 | |
|   // viz::mojom::FrameSinkVideoConsumer implementation.
 | |
|   void OnFrameCaptured(
 | |
|       media::mojom::VideoBufferHandlePtr data,
 | |
|       media::mojom::VideoFrameInfoPtr info,
 | |
|       const gfx::Rect& content_rect,
 | |
|       mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
 | |
|           callbacks) override;
 | |
|   void OnFrameWithEmptyRegionCapture() override {}
 | |
|   void OnStopped() override {}
 | |
|   void OnLog(const std::string& message) override {}
 | |
|   void OnNewSubCaptureTargetVersion(
 | |
|       uint32_t sub_capture_target_version) override {}
 | |
| 
 | |
|   const bool use_shared_texture_;
 | |
| 
 | |
|   const raw_ptr<CefRenderWidgetHostViewOSR> view_;
 | |
|   std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
 | |
| 
 | |
|   gfx::Size size_in_pixels_;
 | |
|   std::optional<gfx::Rect> bounds_in_pixels_;
 | |
| };
 | |
| 
 | |
| #endif  // LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
 |