Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osr : Browser not correctly refreshing on Resize in CEF 129 #3826

Open
Hethsron opened this issue Nov 8, 2024 · 6 comments
Open

osr : Browser not correctly refreshing on Resize in CEF 129 #3826

Hethsron opened this issue Nov 8, 2024 · 6 comments
Labels
bug Bug report osr Related to off-screen rendering windows Windows platform

Comments

@Hethsron
Copy link

Hethsron commented Nov 8, 2024

Describe the bug
The bug was clearly described in the following post and the following issue

Screenshots
For more details, see the video

Expected behavior
When the window size is resized, the view should normally be refreshed.

Versions

  • OS: Windows 10, MacOS
  • CEF Version: 129.0.6668.90
@Hethsron Hethsron added the bug Bug report label Nov 8, 2024
@Hethsron Hethsron changed the title osr : not correctly refreshing on Resize in CEF 129 osr : Browser not correctly refreshing on Resize in CEF 129 Nov 8, 2024
@magreenblatt
Copy link
Collaborator

Duplicate of #3822.

@magreenblatt magreenblatt closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
@magreenblatt
Copy link
Collaborator

You say:

with the CEF sample cefclient --off-screen-rendering-enabled --multi-threaded-message-loop
it does not reproduce the issue because CefRefPtr::WasResized is still called in the CEF_UIT thread so there is no task posted, the work is executed synchronuously.

This suggests that your timing of calling WasResized and returning updated values from GetViewRect may be incorrect. You need to make sure that GetViewRect is returning the correct value when WasResized actually executes.

@Hethsron
Copy link
Author

@magreenblatt Thanks for your quick answer. But after a huge debug session in our side, there is something strange which happens in cef, you can reproduice easily with your cefclient. (see https://magpcss.org/ceforum/viewtopic.php?f=6&t=20038&p=56405&hilit=CEF129#p56405)

@magreenblatt
Copy link
Collaborator

Reopening this issue as it seems unrelated to navigation.

@tishion
Copy link

tishion commented Feb 1, 2025

I can confirm this is a bug, after calling WasResized there is no the expected callback of CefRenderHandler::GetViewRect.

Starts from CEF 127

@randymarsh77
Copy link

randymarsh77 commented Feb 26, 2025

I ran into this problem, since we use --off-screen-rendering-enabled and --enable-gpu. After debugging, here is my understanding of the problem:

Context in Chromium code:

  • From the GPU process, FrameSinkVideoCapturerImpl::MaybeDeliverFrame is called for each frame that will eventually turn into an OnPaint callback.
  • However, it is expected that some frames get dropped. In this event MaybeScheduleRefreshFrame is called. And presumably the expectation is that results in a successful frame delivery.
  • However, this code appears to have an expectation mismatch / bug. In the event of an unsuccessful / dropped frame, the code does not call CompleteCapture. This is the only place the oracle decrements the number of pending frames. (not including "stop rendering" / reset scenarios).
  • The allowance for tracked pending frames to remain > 0 results in kRefreshRequest refreshes to never result in a frame capture.
  • After a frame has been dropped, these refresh requests stop doing anything and the GPU process is stuck in a loop (timer triggered, not synchronous) of scheduling a capture and deciding not to capture.
  • The kRefreshDemand and kCompositorUpdate (dirty rects) will cause a successful re-render.

Context in CEF code:

  • If the dropped frame was the new size, and a resize hold is active for the size, we won't get an OnPaint callback for that size until either a kRefreshDemand or kCompositorUpdate refresh is triggered.
  • WasResized will do nothing, since the resize hold is active.
  • Invalidate(CefPaintElementType.View) will trigger kRefreshDemand which will result in OnPaint and release the resize hold.

In summary, it's a combination of:

  • CEF's resize hold behavior
  • FrameSinkVideoCapturerImpl dropping frames and not accounting for those drops in VideoCaptureOracle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report osr Related to off-screen rendering windows Windows platform
Projects
None yet
Development

No branches or pull requests

4 participants