Reset the queue in ScreenCapturerX11 when updating monitors.

This is a speculative fix for the DCHECK at the top of
ScreenCapturerX11::CaptureScreen(). Whenever |selected_monitor_rect_|
changes, |queue_| should be reset, so that new frames are allocated
with the correct size. This CL adds a reset to UpdateMonitors() which
modifies |selected_monitor_rect_| and is called whenever an X11
configuration-change event is received (for example, when a monitor is
resized).

Bug: chromium:1372579
Change-Id: I9cc84a8b6990802f9d7dde05966ee17a80ddd48e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279065
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Lambros Lambrou <lambroslambrou@chromium.org>
Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org>
Cr-Commit-Position: refs/heads/main@{#38374}
This commit is contained in:
Lambros Lambrou 2022-10-12 17:03:36 -07:00 committed by WebRTC LUCI CQ
parent 99ea39db99
commit e3a8e55b75

View File

@ -185,6 +185,10 @@ void ScreenCapturerX11::InitXrandr() {
RTC_NO_SANITIZE("cfi-icall")
void ScreenCapturerX11::UpdateMonitors() {
// The queue should be reset whenever |selected_monitor_rect_| changes, so
// that the DCHECKs in CaptureScreen() are satisfied.
queue_.Reset();
if (monitors_) {
free_monitors_(monitors_);
monitors_ = nullptr;