Deliver texture from WGC desktop capturer [chromium/src : main]

0 views
Skip to first unread message

Wang, Zhibo1 (Gerrit)

unread,
Mar 27, 2026, 4:08:14 AMMar 27
to Markus Handell, Alexander Cooper, Elad Alon, Ilya Nikolaevskiy, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Alexander Cooper, Elad Alon, Ilya Nikolaevskiy, Qiu, Jianlin and Sam Zackrisson

Wang, Zhibo1 voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Cooper
  • Elad Alon
  • Ilya Nikolaevskiy
  • Qiu, Jianlin
  • Sam Zackrisson
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id2c1470eb1a79faf19c900f5fe9865f7c7d6942a
Gerrit-Change-Number: 7660639
Gerrit-PatchSet: 3
Gerrit-Owner: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Reviewer: Alexander Cooper <alco...@chromium.org>
Gerrit-Reviewer: Elad Alon <elad...@chromium.org>
Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Reviewer: Sam Zackrisson <sa...@chromium.org>
Gerrit-Reviewer: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-CC: Ale Bzk <ales...@chromium.org>
Gerrit-CC: Markus Handell <hand...@google.com>
Gerrit-CC: Per Åhgren <pe...@chromium.org>
Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Sam Zackrisson <sa...@chromium.org>
Gerrit-Attention: Elad Alon <elad...@chromium.org>
Gerrit-Attention: Alexander Cooper <alco...@chromium.org>
Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Comment-Date: Fri, 27 Mar 2026 08:07:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Ilya Nikolaevskiy (Gerrit)

unread,
Mar 27, 2026, 7:32:50 AMMar 27
to Wang, Zhibo1, Markus Handell, Alexander Cooper, Elad Alon, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Alexander Cooper, Elad Alon, Qiu, Jianlin, Sam Zackrisson and Wang, Zhibo1

Ilya Nikolaevskiy added 6 comments

File content/browser/media/capture/desktop_capture_device.cc
Line 704, Patchset 3 (Latest): if (!frame->size().equals(output_size)) {
Ilya Nikolaevskiy . unresolved

One thing I don't see yet (please point me to it If I missed it) is how the capture resolution is enforced. Was it done in the previous CL? Does WGC produce frames already downscaled to the correct size? I presume it just outputs the native resolution of the window/desktop.

There are 2 ways to do it:
1) Scale using DirectX in the WGC capturer code before outputing the texture, but you'll have to wire up the resolution down there.
2) Pass natural_size on top of already provided visible_rect. They pass it in VideoFrame::WrapSharedImage in VideoCaptureImpl [1]. So you'll have to extend VideoFrameInfo [2] and populate it in DeliverTextureToClient.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc;l=358;drc=d899a5c7be25cb43e2c926e643ac147ece0b1d37


[2] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/mojom/video_capture_buffer.mojom;l=17;drc=7cf6ac3dd6dca800fbc0d28e80a7732d4ea90340

Line 901, Patchset 3 (Latest): if (!sii_) {
Ilya Nikolaevskiy . unresolved

You need to recreate sii_ if there's a ContextLoss: https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/client/shared_image_interface.h;l=371;drc=0d56d0143aa2bb6c7bfad81a4e27063ad2a9de8a

If the GPU process crashes the sii_ will become unusable.

Line 924, Patchset 1: auto shared_image = sii_->CreateSharedImage(
Ilya Nikolaevskiy . resolved

This will probably conflict with https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc;l=571;drc=d899a5c7be25cb43e2c926e643ac147ece0b1d37

Wang, Zhibo1

BindVideoFrameOnMediaTaskRunner and GpuMemoryBufferTrackerWin assert the format to be NV12. WGC texture outputs ARGB.

Ilya Nikolaevskiy

No that's actually because the ExternalBuffer you pass has SharedImage, so it will be sent over as a `VideoFrameBufferHandleType::kSharedImageHandle` which doesn't require creation of the SharedImages in the renderer process. So this is fine.

Line 944, Patchset 1: owned_shared_images_.pop_front();
Ilya Nikolaevskiy . resolved

So what happens if we have too many images in flight? Some are destroyed prematurely?

A better approach would be to drop tha frame if there are too many in flight. This will limit the framerate instead of introducing some periods of glitches.

Wang, Zhibo1

The latest patchset uses owned ClientSharedImage, the lifetime is managed by scoped_refptr, and the deque is removed.

Ilya Nikolaevskiy

Acknowledged

Line 951, Patchset 3 (Latest): media::CapturedExternalVideoBuffer(
Ilya Nikolaevskiy . unresolved

Please use OnIncomingCapturedImageZeroCopy instead.

File media/capture/video/video_capture_buffer_tracker_factory_impl.cc
Line 86, Patchset 3 (Latest): dxgi_device_manager_ = DXGIDeviceManager::Create(CHROME_LUID{0, 0});
Ilya Nikolaevskiy . unresolved

Why is this even needed? You are sending ClientSharedImages, therefore the code on L76 would return from the fucntion and this code here will not be executed.

Then, if you want to set it up, you need to pass the correct LUID here. On the machine with multiple GPU adapters it has to use the correct one.

The screenshare capture system doesn't even set the dxgi device manager anymore, but it was in the past. You can see how it was done here: https://crrev.com/c/4623506/18/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc

Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Cooper
  • Elad Alon
  • Qiu, Jianlin
  • Sam Zackrisson
  • Wang, Zhibo1
Gerrit-Attention: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Attention: Alexander Cooper <alco...@chromium.org>
Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
Gerrit-Comment-Date: Fri, 27 Mar 2026 11:32:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Wang, Zhibo1 <zhibo...@intel.com>
Comment-In-Reply-To: Ilya Nikolaevskiy <il...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ilya Nikolaevskiy (Gerrit)

unread,
Mar 27, 2026, 8:20:24 AMMar 27
to Wang, Zhibo1, Markus Handell, Alexander Cooper, Elad Alon, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Alexander Cooper, Elad Alon, Qiu, Jianlin, Sam Zackrisson and Wang, Zhibo1

Ilya Nikolaevskiy added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Ilya Nikolaevskiy . unresolved

Another concern is a multi-gpu systems.

I didn't notice it while reviewing the previous CL.

If the original texture is localted on a wrong adapter, not the one used by the GPU process, It will not be usable. The CreateSharedImage call will fail.

There are several solutions possible:
1) in the DesktopCaptureDevice here create a valid texture and copy the data there before creating the SharedImage.

2) Pass the LUID all the way to the WgcCaptureSession and don't output the texture if it's on a wrong adapter. But I'm not sure how to check if the texture is on the correct adapter yet. Or maybe you should create the D3D11Device on the correct LUID in WgcCapturerWin [1] then the processing of the texture would just fail.

3) Pass the LUID to WgcCaptureSession and somehow register it to output textures on that adapter. I don't know if it's possible. Maybe you can s

You probably can get the LUID from the gpu info where you establish the sii_.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/desktop_capture/win/wgc_capturer_win.cc;l=290;drc=1d5a6e111f7dc0d600c625a9ead6dd0a1b7219a9

Gerrit-Comment-Date: Fri, 27 Mar 2026 12:20:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sam Zackrisson (Gerrit)

unread,
Mar 27, 2026, 9:40:42 AMMar 27
to Wang, Zhibo1, Markus Handell, Alexander Cooper, Elad Alon, Ilya Nikolaevskiy, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Alexander Cooper, Elad Alon, Qiu, Jianlin and Wang, Zhibo1

Sam Zackrisson added 3 comments

Patchset-level comments
Sam Zackrisson . resolved

Thank you for this change.

I don't know the video parts, so will hold off on stamping LGTM for media/webrtc/.

media/webrtc/ LGTM modulo my comment, if the video reviewers agree with and approve the main changes.

File media/webrtc/webrtc_features.h
Line 29, Patchset 3 (Latest):COMPONENT_EXPORT(MEDIA_WEBRTC)
BASE_DECLARE_FEATURE(kWebRtcAllowWgcUsingTexture);
Sam Zackrisson . unresolved

...same `#if` comment as in the .cc file

File media/webrtc/webrtc_features.cc
Line 38, Patchset 3 (Latest):// When enabled, DesktopCapturer will provide a texture handle in DesktopFrame
// instead of mapping texture data, if the WGC capturer is available and
// enabled. In this mode, texture are not mapped by default to reduce memory
// copies. Clients should process texture in the same sequence as desktop
// capturer.
BASE_FEATURE(kWebRtcAllowWgcUsingTexture, base::FEATURE_DISABLED_BY_DEFAULT);
Sam Zackrisson . unresolved

Windows-specific feature flag: This should be within the same `#if BUILDFLAG(IS_WIN)` as the WGC flag above.

Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Cooper
  • Elad Alon
  • Qiu, Jianlin
  • Wang, Zhibo1
Gerrit-Attention: Elad Alon <elad...@chromium.org>
Gerrit-Attention: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Attention: Alexander Cooper <alco...@chromium.org>
Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
Gerrit-Comment-Date: Fri, 27 Mar 2026 13:40:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Alexander Cooper (Gerrit)

unread,
Mar 27, 2026, 6:06:46 PMMar 27
to Wang, Zhibo1, Markus Handell, Elad Alon, Ilya Nikolaevskiy, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Qiu, Jianlin and Wang, Zhibo1

Alexander Cooper added 1 comment

Patchset-level comments
Alexander Cooper . resolved

Looks like you have OWNERS covered without me. Removing myself as I am OOO for the next 4 weeks.

Open in Gerrit

Related details

Attention is currently required from:
  • Elad Alon
  • Qiu, Jianlin
  • Wang, Zhibo1
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id2c1470eb1a79faf19c900f5fe9865f7c7d6942a
Gerrit-Change-Number: 7660639
Gerrit-PatchSet: 3
Gerrit-Owner: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Reviewer: Elad Alon <elad...@chromium.org>
Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Reviewer: Sam Zackrisson <sa...@chromium.org>
Gerrit-Reviewer: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-CC: Ale Bzk <ales...@chromium.org>
Gerrit-CC: Markus Handell <hand...@google.com>
Gerrit-CC: Per Åhgren <pe...@chromium.org>
Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Elad Alon <elad...@chromium.org>
Gerrit-Attention: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
Gerrit-Comment-Date: Fri, 27 Mar 2026 22:06:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Wang, Zhibo1 (Gerrit)

unread,
Mar 30, 2026, 5:05:48 AMMar 30
to Markus Handell, Elad Alon, Ilya Nikolaevskiy, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Ilya Nikolaevskiy, Qiu, Jianlin and Sam Zackrisson

Wang, Zhibo1 added 7 comments

Patchset-level comments
File-level comment, Patchset 3:
Ilya Nikolaevskiy . resolved

Another concern is a multi-gpu systems.

I didn't notice it while reviewing the previous CL.

If the original texture is localted on a wrong adapter, not the one used by the GPU process, It will not be usable. The CreateSharedImage call will fail.

There are several solutions possible:
1) in the DesktopCaptureDevice here create a valid texture and copy the data there before creating the SharedImage.

2) Pass the LUID all the way to the WgcCaptureSession and don't output the texture if it's on a wrong adapter. But I'm not sure how to check if the texture is on the correct adapter yet. Or maybe you should create the D3D11Device on the correct LUID in WgcCapturerWin [1] then the processing of the texture would just fail.

3) Pass the LUID to WgcCaptureSession and somehow register it to output textures on that adapter. I don't know if it's possible. Maybe you can s

You probably can get the LUID from the gpu info where you establish the sii_.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/desktop_capture/win/wgc_capturer_win.cc;l=290;drc=1d5a6e111f7dc0d600c625a9ead6dd0a1b7219a9

Wang, Zhibo1

Implementing `3.` at https://webrtc-review.googlesource.com/c/src/+/461040
While `3.` is truncated, I think the desktop capture texture will be on the d3d11 device that is used to create the pool. So passing the active gpu luid is ok.

File content/browser/media/capture/desktop_capture_device.cc
Line 704, Patchset 3: if (!frame->size().equals(output_size)) {
Ilya Nikolaevskiy . unresolved

One thing I don't see yet (please point me to it If I missed it) is how the capture resolution is enforced. Was it done in the previous CL? Does WGC produce frames already downscaled to the correct size? I presume it just outputs the native resolution of the window/desktop.

There are 2 ways to do it:
1) Scale using DirectX in the WGC capturer code before outputing the texture, but you'll have to wire up the resolution down there.
2) Pass natural_size on top of already provided visible_rect. They pass it in VideoFrame::WrapSharedImage in VideoCaptureImpl [1]. So you'll have to extend VideoFrameInfo [2] and populate it in DeliverTextureToClient.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc;l=358;drc=d899a5c7be25cb43e2c926e643ac147ece0b1d37


[2] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/mojom/video_capture_buffer.mojom;l=17;drc=7cf6ac3dd6dca800fbc0d28e80a7732d4ea90340

You need to recreate sii_ if there's a ContextLoss: https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/client/shared_image_interface.h;l=371;drc=0d56d0143aa2bb6c7bfad81a4e27063ad2a9de8a

If the GPU process crashes the sii_ will become unusable.

Wang, Zhibo1

Done

Line 951, Patchset 3: media::CapturedExternalVideoBuffer(
Ilya Nikolaevskiy . unresolved

Please use OnIncomingCapturedImageZeroCopy instead.

Wang, Zhibo1

We only have the abstract class pointer here and there is no `OnIncomingCapturedImageZeroCopy` member method.

File media/capture/video/video_capture_buffer_tracker_factory_impl.cc
Line 86, Patchset 3: dxgi_device_manager_ = DXGIDeviceManager::Create(CHROME_LUID{0, 0});
Ilya Nikolaevskiy . resolved

Why is this even needed? You are sending ClientSharedImages, therefore the code on L76 would return from the fucntion and this code here will not be executed.

Then, if you want to set it up, you need to pass the correct LUID here. On the machine with multiple GPU adapters it has to use the correct one.

The screenshare capture system doesn't even set the dxgi device manager anymore, but it was in the past. You can see how it was done here: https://crrev.com/c/4623506/18/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc

Wang, Zhibo1

Removed. It was a legacy of early development.

File media/webrtc/webrtc_features.h
Line 29, Patchset 3:COMPONENT_EXPORT(MEDIA_WEBRTC)
BASE_DECLARE_FEATURE(kWebRtcAllowWgcUsingTexture);
Sam Zackrisson . resolved

...same `#if` comment as in the .cc file

Wang, Zhibo1

Done

File media/webrtc/webrtc_features.cc
Line 38, Patchset 3:// When enabled, DesktopCapturer will provide a texture handle in DesktopFrame

// instead of mapping texture data, if the WGC capturer is available and
// enabled. In this mode, texture are not mapped by default to reduce memory
// copies. Clients should process texture in the same sequence as desktop
// capturer.
BASE_FEATURE(kWebRtcAllowWgcUsingTexture, base::FEATURE_DISABLED_BY_DEFAULT);
Sam Zackrisson . resolved

Windows-specific feature flag: This should be within the same `#if BUILDFLAG(IS_WIN)` as the WGC flag above.

Wang, Zhibo1

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Elad Alon
  • Ilya Nikolaevskiy
  • Qiu, Jianlin
  • Sam Zackrisson
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id2c1470eb1a79faf19c900f5fe9865f7c7d6942a
Gerrit-Change-Number: 7660639
Gerrit-PatchSet: 4
Gerrit-Owner: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Reviewer: Elad Alon <elad...@chromium.org>
Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Reviewer: Sam Zackrisson <sa...@chromium.org>
Gerrit-Reviewer: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-CC: Ale Bzk <ales...@chromium.org>
Gerrit-CC: Markus Handell <hand...@google.com>
Gerrit-CC: Per Åhgren <pe...@chromium.org>
Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Sam Zackrisson <sa...@chromium.org>
Gerrit-Attention: Elad Alon <elad...@chromium.org>
Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Comment-Date: Mon, 30 Mar 2026 09:05:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sam Zackrisson <sa...@chromium.org>
Comment-In-Reply-To: Ilya Nikolaevskiy <il...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ilya Nikolaevskiy (Gerrit)

unread,
Apr 7, 2026, 6:47:36 AMApr 7
to Wang, Zhibo1, Markus Handell, Elad Alon, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Qiu, Jianlin, Sam Zackrisson and Wang, Zhibo1

Ilya Nikolaevskiy added 3 comments

File content/browser/media/capture/desktop_capture_device.cc
Line 704, Patchset 3: if (!frame->size().equals(output_size)) {
Ilya Nikolaevskiy . resolved

One thing I don't see yet (please point me to it If I missed it) is how the capture resolution is enforced. Was it done in the previous CL? Does WGC produce frames already downscaled to the correct size? I presume it just outputs the native resolution of the window/desktop.

There are 2 ways to do it:
1) Scale using DirectX in the WGC capturer code before outputing the texture, but you'll have to wire up the resolution down there.
2) Pass natural_size on top of already provided visible_rect. They pass it in VideoFrame::WrapSharedImage in VideoCaptureImpl [1]. So you'll have to extend VideoFrameInfo [2] and populate it in DeliverTextureToClient.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc;l=358;drc=d899a5c7be25cb43e2c926e643ac147ece0b1d37


[2] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/mojom/video_capture_buffer.mojom;l=17;drc=7cf6ac3dd6dca800fbc0d28e80a7732d4ea90340

Wang, Zhibo1

See https://chromium-review.googlesource.com/c/chromium/src/+/7705341

Ilya Nikolaevskiy

Thanks!

Line 951, Patchset 3: media::CapturedExternalVideoBuffer(
Ilya Nikolaevskiy . unresolved

Please use OnIncomingCapturedImageZeroCopy instead.

Wang, Zhibo1

We only have the abstract class pointer here and there is no `OnIncomingCapturedImageZeroCopy` member method.

Ilya Nikolaevskiy

Sorry, I didn't notice that this isn't a public method. Can you use OnIncomingCapturedImage and pass it to OnIncomingCapturedImageZeroCopy() like it's done for android [1]?

[1] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/video_capture_device_client.cc;l=495-498;drc=93155d7838b9aceeace7aa7c8ed6d2f90176fd52

Line 1138, Patchset 6 (Latest): options.set_d3d_device_luid({luid.LowPart, luid.HighPart});
Ilya Nikolaevskiy . unresolved

This will help in most cases, but still will fail if the GPU process restarts.

If you have a E2E PoC running, please find a laptop with 2 adapters: integrated and discreete GPUs. Start the chrome when no external display is attached to the laptop. Then attach the display. Everything should work still. Then open `chrome://crashgpu` in a separate tab. After the process reinitializes the screenshare frames will not be rendereable and you will see a lot of errors at the bottom of chrome://gpu.

The issue is that the active LUID changes mid-capture.

It can be detected relatively easy: just check the `active_gpu().luid` on each frame.

Ideally, in this case you should readback the texture using the starting LUID for adapter creation, then send it down as a YUV software frame.

To that end I think you should make DeliverTextureToClient a bool function and if it fails go down the fallback path.

Open in Gerrit

Related details

Attention is currently required from:
  • Elad Alon
  • Qiu, Jianlin
  • Sam Zackrisson
  • Wang, Zhibo1
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id2c1470eb1a79faf19c900f5fe9865f7c7d6942a
Gerrit-Change-Number: 7660639
Gerrit-PatchSet: 6
Gerrit-Owner: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Reviewer: Elad Alon <elad...@chromium.org>
Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Reviewer: Sam Zackrisson <sa...@chromium.org>
Gerrit-Reviewer: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-CC: Ale Bzk <ales...@chromium.org>
Gerrit-CC: Markus Handell <hand...@google.com>
Gerrit-CC: Per Åhgren <pe...@chromium.org>
Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Sam Zackrisson <sa...@chromium.org>
Gerrit-Attention: Elad Alon <elad...@chromium.org>
Gerrit-Attention: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
Gerrit-Comment-Date: Tue, 07 Apr 2026 10:47:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Qiu, Jianlin (Gerrit)

unread,
Apr 20, 2026, 1:32:44 AMApr 20
to Wang, Zhibo1, Markus Handell, Elad Alon, Ilya Nikolaevskiy, Sam Zackrisson, Chromium LUCI CQ, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Sam Zackrisson and Wang, Zhibo1

Qiu, Jianlin added 1 comment

File content/browser/media/capture/desktop_capture_device.cc
Line 1138, Patchset 6 (Latest): options.set_d3d_device_luid({luid.LowPart, luid.HighPart});
Ilya Nikolaevskiy . unresolved

This will help in most cases, but still will fail if the GPU process restarts.

If you have a E2E PoC running, please find a laptop with 2 adapters: integrated and discreete GPUs. Start the chrome when no external display is attached to the laptop. Then attach the display. Everything should work still. Then open `chrome://crashgpu` in a separate tab. After the process reinitializes the screenshare frames will not be rendereable and you will see a lot of errors at the bottom of chrome://gpu.

The issue is that the active LUID changes mid-capture.

It can be detected relatively easy: just check the `active_gpu().luid` on each frame.

Ideally, in this case you should readback the texture using the starting LUID for adapter creation, then send it down as a YUV software frame.

To that end I think you should make DeliverTextureToClient a bool function and if it fails go down the fallback path.

Qiu, Jianlin

The situation I see with current CL:

I'm on a KabyLake-G(i7-8809G) platform which has both Intel integrated graphics and AMD integrated graphics. I have the monitor initially attached to my intel graphics, where I started screen capture/encode. Everything looks fine when I am capturing the entire screen.

Then I attach another monitor to the AMD graphics. No I have an extended desktop, with my chrome browser still shown in the first monitor.

Now the screen capture stops. Some related logs:
"[29828:18696:0417/162911.636:VERBOSE1:components\viz\service\gl\gpu_service_impl.cc:1066] GPU: Display Metrics changed
[29828:18696:0417/162911.643:VERBOSE1:gpu\command_buffer\service\shared_image\shared_image_factory.cc:682] CreateSharedImageWithBuffer[CompoundImageBacking] size=1920x1080 usage=RasterRead|DisplayRead|Scanout|VideoEncodeAccelerator format=BGRA_8888 gmb_type=platform
[13292:23348:0417/162911.677:INFO:third_party\webrtc\modules\desktop_capture\win\wgc_capture_session.cc:844] Capture target has been closed.
[13292:23348:0417/162911.677:ERROR:third_party\webrtc\modules\desktop_capture\win\wgc_capture_session.cc:442] The target source has been closed.
[13292:23348:0417/162911.678:ERROR:third_party\webrtc\modules\desktop_capture\win\wgc_capturer_win.cc:431] GetFrame failed."

chrome://gpu is not reporting GPU process crash, though.

Open in Gerrit

Related details

Attention is currently required from:
  • Elad Alon
  • Sam Zackrisson
  • Wang, Zhibo1
Gerrit-Comment-Date: Mon, 20 Apr 2026 05:32:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ilya Nikolaevskiy <il...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ilya Nikolaevskiy (Gerrit)

unread,
Apr 20, 2026, 4:30:23 AMApr 20
to Wang, Zhibo1, Markus Handell, Elad Alon, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Sam Zackrisson and Wang, Zhibo1

Ilya Nikolaevskiy added 1 comment

File content/browser/media/capture/desktop_capture_device.cc
Line 1138, Patchset 6 (Latest): options.set_d3d_device_luid({luid.LowPart, luid.HighPart});
Ilya Nikolaevskiy . unresolved

This will help in most cases, but still will fail if the GPU process restarts.

If you have a E2E PoC running, please find a laptop with 2 adapters: integrated and discreete GPUs. Start the chrome when no external display is attached to the laptop. Then attach the display. Everything should work still. Then open `chrome://crashgpu` in a separate tab. After the process reinitializes the screenshare frames will not be rendereable and you will see a lot of errors at the bottom of chrome://gpu.

The issue is that the active LUID changes mid-capture.

It can be detected relatively easy: just check the `active_gpu().luid` on each frame.

Ideally, in this case you should readback the texture using the starting LUID for adapter creation, then send it down as a YUV software frame.

To that end I think you should make DeliverTextureToClient a bool function and if it fails go down the fallback path.

Qiu, Jianlin

The situation I see with current CL:

I'm on a KabyLake-G(i7-8809G) platform which has both Intel integrated graphics and AMD integrated graphics. I have the monitor initially attached to my intel graphics, where I started screen capture/encode. Everything looks fine when I am capturing the entire screen.

Then I attach another monitor to the AMD graphics. No I have an extended desktop, with my chrome browser still shown in the first monitor.

Now the screen capture stops. Some related logs:
"[29828:18696:0417/162911.636:VERBOSE1:components\viz\service\gl\gpu_service_impl.cc:1066] GPU: Display Metrics changed
[29828:18696:0417/162911.643:VERBOSE1:gpu\command_buffer\service\shared_image\shared_image_factory.cc:682] CreateSharedImageWithBuffer[CompoundImageBacking] size=1920x1080 usage=RasterRead|DisplayRead|Scanout|VideoEncodeAccelerator format=BGRA_8888 gmb_type=platform
[13292:23348:0417/162911.677:INFO:third_party\webrtc\modules\desktop_capture\win\wgc_capture_session.cc:844] Capture target has been closed.
[13292:23348:0417/162911.677:ERROR:third_party\webrtc\modules\desktop_capture\win\wgc_capture_session.cc:442] The target source has been closed.
[13292:23348:0417/162911.678:ERROR:third_party\webrtc\modules\desktop_capture\win\wgc_capturer_win.cc:431] GetFrame failed."

chrome://gpu is not reporting GPU process crash, though.

Ilya Nikolaevskiy

That failure is something completely different. Seems like attaching a new display breaks something inside WGC and it stops the screenshare.

Also, just attaching a new display to another port might not change the default GPU in the system. It might still use the other one, if you have 2 displays. Please try different configurations and observe which GPU adapter is marked as `*active*` in the chrome://gpu. Remember to restart chrome each time you change the display configuration. You need to see different adapter being active.

Usually, then no external displays are attached, you get integrated intel GPU as the active one, once you attach something to the laptop, the discrete AMD adapter will be active (after the chrome restart, ofcourse! It only changes adapter on GPU process startup).

Please do it as I outlined: start the chrome (not presentation, just the browser). It will pick up intel adapter as a default one. Then attach the display. Now AMD will be default one, but the chrome will still use what it did before. Then start the screenshare. Crash the gpu process and it will restart with a new default adapter.

This shouldn't stop WGC screenshare and would expose the issue I've outlined: capturer would still produce texture on the Intel adapter, which won't be renderable in the GPU process.

Gerrit-Comment-Date: Mon, 20 Apr 2026 08:30:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Qiu, Jianlin <jianl...@intel.com>
Comment-In-Reply-To: Ilya Nikolaevskiy <il...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ilya Nikolaevskiy (Gerrit)

unread,
Apr 20, 2026, 4:32:02 AMApr 20
to Wang, Zhibo1, Markus Handell, Elad Alon, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
File content/browser/media/capture/desktop_capture_device.cc
Ilya Nikolaevskiy

Also, in case there was a misunderstanding, you have to open a new tab with "chrome://gpucrash" to manually trigger the gpu process crash to restart it, so it will pick up a new default adapter. There will be no natural crash, it's you who needs to trigger it.

Gerrit-Comment-Date: Mon, 20 Apr 2026 08:31:42 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Wang, Zhibo1 (Gerrit)

unread,
May 11, 2026, 2:10:02 AM (7 days ago) May 11
to Markus Handell, Elad Alon, Ilya Nikolaevskiy, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Ilya Nikolaevskiy and Sam Zackrisson

Wang, Zhibo1 added 1 comment

File content/browser/media/capture/desktop_capture_device.cc
Line 1138, Patchset 6: options.set_d3d_device_luid({luid.LowPart, luid.HighPart});
Wang, Zhibo1

Jianlin's device is kind of special. I use my notebook with Intel iGPU + NVIDIA dGPU. The results are:

  • Regardless of whether the external display is attached, when we start the browser or run `chrome://gpucrash`, the Intel iGPU is always the `*active*` GPU in `chrome://gpu`.
  • The `GPU preference` in Windows settings `System > Display > Graphics` is the one that determines the active GPU. For Chrome, `Let Windows decide` or `Power saving` selects the Intel iGPU, while `High performance` selects the NVIDIA dGPU.

Since the above case is very rare, currently we report a client error in case of active gpu luid changing.

Open in Gerrit

Related details

Attention is currently required from:
  • Elad Alon
  • Ilya Nikolaevskiy
  • Sam Zackrisson
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id2c1470eb1a79faf19c900f5fe9865f7c7d6942a
Gerrit-Change-Number: 7660639
Gerrit-PatchSet: 9
Gerrit-Owner: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Reviewer: Elad Alon <elad...@chromium.org>
Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Reviewer: Sam Zackrisson <sa...@chromium.org>
Gerrit-Reviewer: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-CC: Ale Bzk <ales...@chromium.org>
Gerrit-CC: Markus Handell <hand...@google.com>
Gerrit-CC: Per Åhgren <pe...@chromium.org>
Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Sam Zackrisson <sa...@chromium.org>
Gerrit-Attention: Elad Alon <elad...@chromium.org>
Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
Gerrit-Comment-Date: Mon, 11 May 2026 06:09:46 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Ilya Nikolaevskiy (Gerrit)

unread,
6:52 AM (2 hours ago) 6:52 AM
to Wang, Zhibo1, Markus Handell, Elad Alon, Sam Zackrisson, Chromium LUCI CQ, Qiu, Jianlin, Ale Bzk, chromium...@chromium.org, Per Åhgren, Rijubrata Bhaumik, alexmo...@chromium.org, chfreme...@chromium.org, creis...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org, navigation...@chromium.org
Attention needed from Elad Alon, Sam Zackrisson and Wang, Zhibo1

Ilya Nikolaevskiy added 2 comments

File content/browser/media/capture/desktop_capture_device.cc
Ilya Nikolaevskiy

Please add a TODO in the code to implement the readback fallback where DeliverTextureToClient() fails.

Thanks for adding this!

Line 1280, Patchset 9 (Latest): auto luid = GpuDataManager::GetInstance()->GetGPUInfo().active_gpu().luid;
Ilya Nikolaevskiy . unresolved

There's a very low chance of this happening, but if GPU reinitializes between this and the call above there options is set, it will have mismatching LUIDs.

Please use `options.d3d_device_luid()` instead.

Open in Gerrit

Related details

Attention is currently required from:
  • Elad Alon
  • Sam Zackrisson
  • Wang, Zhibo1
Gerrit-Attention: Wang, Zhibo1 <zhibo...@intel.com>
Gerrit-Comment-Date: Mon, 18 May 2026 10:52:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Wang, Zhibo1 <zhibo...@intel.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages