Remove D3D KeyedMutex Path in Media Capture patch [chromium/src : main]

0 views
Skip to first unread message

Shaobo Yan (Gerrit)

unread,
Oct 16, 2025, 3:58:36 AM10/16/25
to Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Sunny Sachanandani

Shaobo Yan added 1 comment

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Shaobo Yan . resolved

PTAL, thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Sunny Sachanandani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
Gerrit-Change-Number: 7035392
Gerrit-PatchSet: 5
Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
Gerrit-Comment-Date: Thu, 16 Oct 2025 07:56:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sunny Sachanandani (Gerrit)

unread,
Oct 16, 2025, 1:53:33 PM10/16/25
to Shaobo Yan, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Shaobo Yan

Sunny Sachanandani voted and added 1 comment

Votes added by Sunny Sachanandani

Code-Review+1

1 comment

Patchset-level comments
Sunny Sachanandani . resolved

lgtm from me, but it requires OWNERS approvals from media folks

Open in Gerrit

Related details

Attention is currently required from:
  • Shaobo Yan
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
    Gerrit-Change-Number: 7035392
    Gerrit-PatchSet: 5
    Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
    Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Comment-Date: Thu, 16 Oct 2025 17:53:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Shaobo Yan (Gerrit)

    unread,
    Oct 20, 2025, 2:35:49 AM10/20/25
    to Ilya Nikolaevskiy, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Ilya Nikolaevskiy

    Shaobo Yan added 1 comment

    Patchset-level comments
    Shaobo Yan . resolved

    ilnik@, would you mind to take a look?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ilya Nikolaevskiy
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
    Gerrit-Change-Number: 7035392
    Gerrit-PatchSet: 5
    Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
    Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
    Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Oct 2025 06:35:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jianlin Qiu (Gerrit)

    unread,
    Oct 20, 2025, 4:11:52 AM10/20/25
    to Shaobo Yan, Ilya Nikolaevskiy, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Ilya Nikolaevskiy and Shaobo Yan

    Jianlin Qiu added 1 comment

    Patchset-level comments
    Jianlin Qiu . resolved

    At https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/fake_video_capture_device.cc;l=956;drc=6099daedae9edf5b9ccbfb8267e108aaaf87371b we copy from mapped buffer to GMB GPU texture. If you remove the keyed_mutex without proper sync for fake GMB capture, VEA will get artifacts.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ilya Nikolaevskiy
    • Shaobo Yan
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
    Gerrit-Change-Number: 7035392
    Gerrit-PatchSet: 5
    Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
    Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
    Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
    Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Oct 2025 08:11:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Shaobo Yan (Gerrit)

    unread,
    Oct 20, 2025, 4:27:30 AM10/20/25
    to Jianlin Qiu, Ilya Nikolaevskiy, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Ilya Nikolaevskiy and Jianlin Qiu

    Shaobo Yan added 1 comment

    Patchset-level comments
    Jianlin Qiu . resolved

    At https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/fake_video_capture_device.cc;l=956;drc=6099daedae9edf5b9ccbfb8267e108aaaf87371b we copy from mapped buffer to GMB GPU texture. If you remove the keyed_mutex without proper sync for fake GMB capture, VEA will get artifacts.

    Shaobo Yan

    Thanks Johnny@ for this info. I'll see what I can do for fake capture.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ilya Nikolaevskiy
    • Jianlin Qiu
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
    Gerrit-Change-Number: 7035392
    Gerrit-PatchSet: 5
    Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
    Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
    Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
    Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
    Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Oct 2025 08:26:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jianlin Qiu <jianl...@intel.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ilya Nikolaevskiy (Gerrit)

    unread,
    Oct 20, 2025, 5:49:46 AM10/20/25
    to Shaobo Yan, Jianlin Qiu, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Jianlin Qiu and Shaobo Yan

    Ilya Nikolaevskiy added 1 comment

    Patchset-level comments
    Ilya Nikolaevskiy . unresolved

    You need to update some more places.

    1) FakeVideoCaptureDevice [1] relies on this function [2] to copy the data (the call goes through [3]).
    It uses keyed mutex. The real VideoCaptureDeviceMfWin waits for the copy to be completed, but the fake one doesn't. You need to add some synchronisation there.

    2) Search for places where keyed mutex is used, like [4]. Maybe it should be removed there too?

    [1] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/fake_video_capture_device.cc;l=950;drc=62a9a00176f862e688fa47919ed6f19b59f77b5f

    [2] https://source.chromium.org/chromium/chromium/src/+/main:gpu/ipc/common/dxgi_helpers.cc;l=260;drc=616929bddb1ee689a77ebb7522e094189df17b9c

    [3] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/win/gpu_memory_buffer_tracker_win.cc;l=40;drc=cd29a0041770c8ae3e3894e0cee3d3526e706215

    [4] https://source.chromium.org/chromium/chromium/src/+/main:gpu/ipc/common/dxgi_helpers.cc;l=148;drc=616929bddb1ee689a77ebb7522e094189df17b9c

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jianlin Qiu
    • Shaobo Yan
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
      Gerrit-Change-Number: 7035392
      Gerrit-PatchSet: 5
      Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
      Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
      Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
      Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
      Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
      Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
      Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
      Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
      Gerrit-Comment-Date: Mon, 20 Oct 2025 09:49:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Shaobo Yan (Gerrit)

      unread,
      Feb 24, 2026, 3:46:08 AM (10 days ago) Feb 24
      to Qiu, Jianlin, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
      Attention needed from Qiu, Jianlin and Sunny Sachanandani

      Shaobo Yan voted and added 1 comment

      Votes added by Shaobo Yan

      Commit-Queue+1

      1 comment

      Patchset-level comments
      File-level comment, Patchset 7 (Latest):
      Shaobo Yan . resolved

      sunnyps@,ilnik@ and jianlin@, I've updated the CL to clean more keyed_mutex, including fake_camera. Pls help to take a look, thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Qiu, Jianlin
      • Sunny Sachanandani
      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: I91fae57f566fa2016bf0e37bc0960fb737168db8
        Gerrit-Change-Number: 7035392
        Gerrit-PatchSet: 7
        Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
        Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
        Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 08:45:43 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Qiu, Jianlin (Gerrit)

        unread,
        Feb 24, 2026, 3:53:03 AM (10 days ago) Feb 24
        to Shaobo Yan, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Shaobo Yan and Sunny Sachanandani

        Qiu, Jianlin added 1 comment

        Patchset-level comments
        Shaobo Yan . resolved

        sunnyps@,ilnik@ and jianlin@, I've updated the CL to clean more keyed_mutex, including fake_camera. Pls help to take a look, thanks!

        Qiu, Jianlin

        Please refer to my comment for PS5. The fake camera device is not using the Mock device.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Shaobo Yan
        • Sunny Sachanandani
        Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 08:52:58 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Shaobo Yan <shao...@microsoft.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Shaobo Yan (Gerrit)

        unread,
        Feb 24, 2026, 4:12:23 AM (10 days ago) Feb 24
        to Qiu, Jianlin, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Qiu, Jianlin and Sunny Sachanandani

        Shaobo Yan added 1 comment

        Patchset-level comments
        Shaobo Yan . resolved

        sunnyps@,ilnik@ and jianlin@, I've updated the CL to clean more keyed_mutex, including fake_camera. Pls help to take a look, thanks!

        Qiu, Jianlin

        Please refer to my comment for PS5. The fake camera device is not using the Mock device.

        Shaobo Yan

        Thanks. I think the sync is handled by:

        1.buffer_access = GetHandleForInProcessAccess() — returns a DXGIGMBTrackerHandle wrapping shared memory.

        2.PaintFrame() — writes frame data into shared memory (CPU-side, no GPU involved yet).

        3. buffer_access.reset() — destroys DXGIGMBTrackerHandle, whose destructor calls:
        CopyShMemToDXGIBuffer() → CopyMemToD3D11Tex()
        UpdateSubresource() — queues GPU copy from shared memory → GPU texture.
        EnqueueSetEvent() + event.Wait() — blocks the CPU thread until the GPU finishes the copy.
        Only then does reset() return.

        4.The frame is delivered to VEA via OnIncomingCapturedBuffer() after reset() has returned.

        Am I missing something?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Qiu, Jianlin
        • Sunny Sachanandani
        Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 09:12:01 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Shaobo Yan <shao...@microsoft.com>
        Comment-In-Reply-To: Qiu, Jianlin <jianl...@intel.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ilya Nikolaevskiy (Gerrit)

        unread,
        Feb 24, 2026, 4:47:35 AM (10 days ago) Feb 24
        to Shaobo Yan, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Qiu, Jianlin, Shaobo Yan and Sunny Sachanandani

        Ilya Nikolaevskiy added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Qiu, Jianlin
        • Shaobo Yan
        • Sunny Sachanandani
        Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 09:47:22 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Shaobo Yan (Gerrit)

        unread,
        Feb 24, 2026, 5:06:48 AM (10 days ago) Feb 24
        to Qiu, Jianlin, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Ilya Nikolaevskiy, Qiu, Jianlin and Sunny Sachanandani

        Shaobo Yan added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Shaobo Yan

        I think we already support the mechanism which called read_lock_fences_enabled to ensure gpu process returned the frame until all ops finished. https://chromium-review.googlesource.com/c/chromium/src/+/5194586

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ilya Nikolaevskiy
        • Qiu, Jianlin
        • Sunny Sachanandani
        Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 10:06:20 +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,
        Feb 24, 2026, 7:24:27 AM (9 days ago) Feb 24
        to Shaobo Yan, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Qiu, Jianlin, Shaobo Yan and Sunny Sachanandani

        Ilya Nikolaevskiy added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Shaobo Yan

        I think we already support the mechanism which called read_lock_fences_enabled to ensure gpu process returned the frame until all ops finished. https://chromium-review.googlesource.com/c/chromium/src/+/5194586

        Ilya Nikolaevskiy

        Are you sure this is happening in copyExternalImageToTexture[1] path too?
        I can see that it wraps shared image[2] to WebGPUMailboxTexture, but i don't see how it will prolong the associated AcceleratedStaticBitmapImage lifetime.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=670;drc=e96112bd1f50723c5b4e3f826d9b8e0094464fc7

        [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=1012;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Qiu, Jianlin
        • Shaobo Yan
        • Sunny Sachanandani
        Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Attention: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 12:24:15 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Shaobo Yan <shao...@microsoft.com>
        Comment-In-Reply-To: Ilya Nikolaevskiy <il...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Qiu, Jianlin (Gerrit)

        unread,
        Feb 24, 2026, 7:47:59 PM (9 days ago) Feb 24
        to Shaobo Yan, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Shaobo Yan and Sunny Sachanandani

        Qiu, Jianlin added 1 comment

        Patchset-level comments
        Shaobo Yan . resolved

        sunnyps@,ilnik@ and jianlin@, I've updated the CL to clean more keyed_mutex, including fake_camera. Pls help to take a look, thanks!

        Qiu, Jianlin

        Please refer to my comment for PS5. The fake camera device is not using the Mock device.

        Shaobo Yan

        Thanks. I think the sync is handled by:

        1.buffer_access = GetHandleForInProcessAccess() — returns a DXGIGMBTrackerHandle wrapping shared memory.

        2.PaintFrame() — writes frame data into shared memory (CPU-side, no GPU involved yet).

        3. buffer_access.reset() — destroys DXGIGMBTrackerHandle, whose destructor calls:
        CopyShMemToDXGIBuffer() → CopyMemToD3D11Tex()
        UpdateSubresource() — queues GPU copy from shared memory → GPU texture.
        EnqueueSetEvent() + event.Wait() — blocks the CPU thread until the GPU finishes the copy.
        Only then does reset() return.

        4.The frame is delivered to VEA via OnIncomingCapturedBuffer() after reset() has returned.

        Am I missing something?

        Qiu, Jianlin

        Acked

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Shaobo Yan
        • Sunny Sachanandani
        Gerrit-Comment-Date: Wed, 25 Feb 2026 00:47:53 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Shaobo Yan <shao...@microsoft.com>
        Comment-In-Reply-To: Qiu, Jianlin <jianl...@intel.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Shaobo Yan (Gerrit)

        unread,
        Feb 25, 2026, 9:25:08 AM (8 days ago) Feb 25
        to Qiu, Jianlin, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Ilya Nikolaevskiy and Sunny Sachanandani

        Shaobo Yan added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Shaobo Yan

        I think we already support the mechanism which called read_lock_fences_enabled to ensure gpu process returned the frame until all ops finished. https://chromium-review.googlesource.com/c/chromium/src/+/5194586

        Ilya Nikolaevskiy

        Are you sure this is happening in copyExternalImageToTexture[1] path too?
        I can see that it wraps shared image[2] to WebGPUMailboxTexture, but i don't see how it will prolong the associated AcceleratedStaticBitmapImage lifetime.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=670;drc=e96112bd1f50723c5b4e3f826d9b8e0094464fc7

        [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=1012;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        Shaobo Yan

        Correct. I think CopyEI2T path doesn't count in this. We need to integrate the similar mechanism for it. I'll use another CL to address this.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ilya Nikolaevskiy
        • Sunny Sachanandani
        Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Comment-Date: Wed, 25 Feb 2026 14:24:30 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Shaobo Yan <shao...@microsoft.com>
        Comment-In-Reply-To: Ilya Nikolaevskiy <il...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ilya Nikolaevskiy (Gerrit)

        unread,
        Feb 25, 2026, 9:27:37 AM (8 days ago) Feb 25
        to Shaobo Yan, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Shaobo Yan and Sunny Sachanandani

        Ilya Nikolaevskiy added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Shaobo Yan

        I think we already support the mechanism which called read_lock_fences_enabled to ensure gpu process returned the frame until all ops finished. https://chromium-review.googlesource.com/c/chromium/src/+/5194586

        Ilya Nikolaevskiy

        Are you sure this is happening in copyExternalImageToTexture[1] path too?
        I can see that it wraps shared image[2] to WebGPUMailboxTexture, but i don't see how it will prolong the associated AcceleratedStaticBitmapImage lifetime.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=670;drc=e96112bd1f50723c5b4e3f826d9b8e0094464fc7

        [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=1012;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        Shaobo Yan

        Correct. I think CopyEI2T path doesn't count in this. We need to integrate the similar mechanism for it. I'll use another CL to address this.

        Ilya Nikolaevskiy

        Thanks! I'll LGTM this CL once you rebase it on that CL, or land it. I think we mustn't land this before the issue with CopyExternalTexture is fixed.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Shaobo Yan
        • Sunny Sachanandani
        Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Comment-Date: Wed, 25 Feb 2026 14:27:21 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Shaobo Yan (Gerrit)

        unread,
        Feb 25, 2026, 8:16:02 PM (8 days ago) Feb 25
        to Qiu, Jianlin, Ilya Nikolaevskiy, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Ilya Nikolaevskiy and Sunny Sachanandani

        Shaobo Yan added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Shaobo Yan

        I think we already support the mechanism which called read_lock_fences_enabled to ensure gpu process returned the frame until all ops finished. https://chromium-review.googlesource.com/c/chromium/src/+/5194586

        Ilya Nikolaevskiy

        Are you sure this is happening in copyExternalImageToTexture[1] path too?
        I can see that it wraps shared image[2] to WebGPUMailboxTexture, but i don't see how it will prolong the associated AcceleratedStaticBitmapImage lifetime.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=670;drc=e96112bd1f50723c5b4e3f826d9b8e0094464fc7

        [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=1012;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        Shaobo Yan

        Correct. I think CopyEI2T path doesn't count in this. We need to integrate the similar mechanism for it. I'll use another CL to address this.

        Ilya Nikolaevskiy

        Thanks! I'll LGTM this CL once you rebase it on that CL, or land it. I think we mustn't land this before the issue with CopyExternalTexture is fixed.

        Shaobo Yan

        Agree. I'll keep this CL on.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ilya Nikolaevskiy
        • Sunny Sachanandani
        Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Comment-Date: Thu, 26 Feb 2026 01:15:41 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Sunny Sachanandani (Gerrit)

        unread,
        Feb 26, 2026, 7:57:48 PM (7 days ago) Feb 26
        to Shaobo Yan, Qiu, Jianlin, Ilya Nikolaevskiy, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Ilya Nikolaevskiy and Shaobo Yan

        Sunny Sachanandani added 4 comments

        File gpu/ipc/common/dxgi_helpers.cc
        Line 296, Patchset 7 (Latest): base::WaitableEvent event(
        base::WaitableEvent::ResetPolicy::AUTOMATIC,
        base::WaitableEvent::InitialState::NOT_SIGNALED);
        Sunny Sachanandani . unresolved

        Just use the default params here - we don't really care about the event being reset which is also a bit dangerous since it can lead to an infinite wait

        Line 303, Patchset 7 (Latest): device_context->Flush();
        Sunny Sachanandani . unresolved

        I believe EnqueueSetEvent guarantees a flush and if it fails, it probably means the device is lost and flushing won't really do anything.

        File media/capture/video/win/video_capture_device_mf_win.cc
        Line 722, Patchset 7 (Latest): base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
        base::WaitableEvent::InitialState::NOT_SIGNALED);
        Sunny Sachanandani . unresolved

        Same here - the default params are what you want.

        Line 731, Patchset 7 (Latest): device_context->Flush();
        Sunny Sachanandani . unresolved

        And here - we don't want to flush if EnqueueSetEvent fails - that means something catastrophic has happened to the D3D11 device.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ilya Nikolaevskiy
        • Shaobo Yan
        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: I91fae57f566fa2016bf0e37bc0960fb737168db8
        Gerrit-Change-Number: 7035392
        Gerrit-PatchSet: 7
        Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
        Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Comment-Date: Fri, 27 Feb 2026 00:57:43 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ilya Nikolaevskiy (Gerrit)

        unread,
        Feb 27, 2026, 6:59:24 AM (6 days ago) Feb 27
        to Shaobo Yan, Qiu, Jianlin, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Shaobo Yan

        Ilya Nikolaevskiy added 1 comment

        Patchset-level comments
        Ilya Nikolaevskiy . unresolved

        There's a new setback here: WebGPU and ImportExternalTexture.

        When the call happens, it issues GPU commands and doesn't hold the video frame while the commands are executing. This leads to renderer process returning the video frame to the video captuerer, while the GPU process might still work with the texture. So now the keyed mutex is needed to protext the texture. It still might happen that the capturer will repopulate the texture with the next frame, but it will result only in a small jitter instead of tearing or glitches in the texture.

        I think HW encoders also might do similar thing: hold onto texture while the video frame is already returned to the capturer, but currently HW encoder wrappers do a local copy of the texture first, exactly to combat this: https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/windows/media_foundation_video_encode_accelerator_win.cc;l=2274;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        There might be more similar bugs which are mitigated by using the keyed mutex.

        Shaobo Yan

        I think we already support the mechanism which called read_lock_fences_enabled to ensure gpu process returned the frame until all ops finished. https://chromium-review.googlesource.com/c/chromium/src/+/5194586

        Ilya Nikolaevskiy

        Are you sure this is happening in copyExternalImageToTexture[1] path too?
        I can see that it wraps shared image[2] to WebGPUMailboxTexture, but i don't see how it will prolong the associated AcceleratedStaticBitmapImage lifetime.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=670;drc=e96112bd1f50723c5b4e3f826d9b8e0094464fc7

        [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=1012;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

        Shaobo Yan

        Correct. I think CopyEI2T path doesn't count in this. We need to integrate the similar mechanism for it. I'll use another CL to address this.

        Ilya Nikolaevskiy

        Thanks! I'll LGTM this CL once you rebase it on that CL, or land it. I think we mustn't land this before the issue with CopyExternalTexture is fixed.

        Shaobo Yan

        Agree. I'll keep this CL on.

        Ilya Nikolaevskiy

        I've seen crrev.com/7614912 to fix it, thank you for CCing me there. Could you please explain to me how it ensures VideoFrame isn't released and returned to the capturer? Maybe I've missed something in my explanation below.

        So, in [1] a ClientSharedImage is wrapped as WebGPU texture, and that webgpu texture will be kept alive after your change untill the webgpu copy or import completes, I agree. But that code only holds ClientSharedImage, which is basically a mailbox. It doesn't ensure the accelerated static bitmap image or media::VideoFrame is kept alive.

        To my knowledge, there's no code right now which keeps VideoFrame alive while the corresponding SharedImage is alive.

        So it still can happen that the Accelerated Static Bitmap Image is destroyed, the VideoFrame is destroyed, it's returned to the capturer, capturer reuses the video frame, fills the underlying D3D texture with new data (creating a data race). Then this texture will reach the renderer again.

        In the first place, SharedImage lifetime isn't an issue here. The SharedImage will be alive until the capture is stopped, it's reused [2] for new frames, with the same underlying D3D texture. It will be only destroyed then the capturer is terminated [3].

        However, the capturer is allowed to reuse the texture once the VideoFrame is destroyed [4]. So there needs to be some mechanism to ensure the VideoFrame isn't destoyed until the ClientSharedImage is not used anymore.

        Maybe the ClientSharedImage is decoupled from VideoFrame somewhere along the path so it's impossible to hold the reference to the VideoFrame itself. Maybe it's not held by the AcceleratedStaticImageBitmap.
        Then the solution is to add the destruction observer to the ClientSharedImage itself, not the VideoFrame itself in [3]. Then as long as someone holds the ClientSharedImage or the VideoFrame (which holds ClientSharedImage), the capturer will not be allowed to reuse the texture.

        Now I think this also applies to the ImportExternalTexture path.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_queue.cc;l=1012;drc=542eedeaf4606aec2003451a8365ac5a0269e33e

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

        [3] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc;l=224;drc=56c66e417c83e2096a4e4e8a5c4ab7bbd525c9f3

        [4] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Shaobo Yan
        Gerrit-Comment-Date: Fri, 27 Feb 2026 11:59:12 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Shaobo Yan (Gerrit)

        unread,
        Feb 27, 2026, 8:59:25 PM (6 days ago) Feb 27
        to Qiu, Jianlin, Ilya Nikolaevskiy, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Ilya Nikolaevskiy

        Shaobo Yan added 1 comment

        Patchset-level comments
        Shaobo Yan

        Thanks for take a deep look into this path! I think in the code path we do:
        1. https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gpu/webgpu_mailbox_texture.cc;drc=56c66e417c83e2096a4e4e8a5c4ab7bbd525c9f3;l=175 We use `base::RetainedRef` for the imported media::VideoFrame. Until webgpu_mailbox_texture is destroyed (https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gpu/webgpu_mailbox_texture.cc;drc=56c66e417c83e2096a4e4e8a5c4ab7bbd525c9f3;l=242). So I think this approach ensures both shared image and media::VideoFrame are not reach refcounted zero until webgpu_mailbox_texture is destroyed. Pls correct me if this mechanism not work or not cover all cases.
        2. For GPUExternalTexture(a.k.a importExternalTexture), we have a cache mechanism and hold a strong reference for media::VideoFrame. And before we release the ref object, we need to call that function to ensure all gpu commands finished. So I think importExternalTexture is safe even the mechanism in 1 is not work.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ilya Nikolaevskiy
        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: I91fae57f566fa2016bf0e37bc0960fb737168db8
        Gerrit-Change-Number: 7035392
        Gerrit-PatchSet: 7
        Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
        Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
        Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
        Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
        Gerrit-Attention: Ilya Nikolaevskiy <il...@chromium.org>
        Gerrit-Comment-Date: Sat, 28 Feb 2026 01:58:51 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ilya Nikolaevskiy (Gerrit)

        unread,
        Mar 2, 2026, 4:14:33 AM (4 days ago) Mar 2
        to Shaobo Yan, Qiu, Jianlin, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Shaobo Yan

        Ilya Nikolaevskiy voted and added 2 comments

        Votes added by Ilya Nikolaevskiy

        Code-Review+1

        2 comments

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

        You need to update some more places.

        1) FakeVideoCaptureDevice [1] relies on this function [2] to copy the data (the call goes through [3]).
        It uses keyed mutex. The real VideoCaptureDeviceMfWin waits for the copy to be completed, but the fake one doesn't. You need to add some synchronisation there.

        2) Search for places where keyed mutex is used, like [4]. Maybe it should be removed there too?

        [1] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/fake_video_capture_device.cc;l=950;drc=62a9a00176f862e688fa47919ed6f19b59f77b5f

        [2] https://source.chromium.org/chromium/chromium/src/+/main:gpu/ipc/common/dxgi_helpers.cc;l=260;drc=616929bddb1ee689a77ebb7522e094189df17b9c

        [3] https://source.chromium.org/chromium/chromium/src/+/main:media/capture/video/win/gpu_memory_buffer_tracker_win.cc;l=40;drc=cd29a0041770c8ae3e3894e0cee3d3526e706215

        [4] https://source.chromium.org/chromium/chromium/src/+/main:gpu/ipc/common/dxgi_helpers.cc;l=148;drc=616929bddb1ee689a77ebb7522e094189df17b9c

        Ilya Nikolaevskiy

        I think now that you do not remove keyed mutex acquiring comletely, but ensure that it's gated behind the check on the texture flags, this is fine.

        Ilya Nikolaevskiy . resolved
        Ilya Nikolaevskiy

        Ah, I see, I was looking at the wrong path (CopyFromCanvas instead of CopyFromVideoElement). It seems that everything is covered here. Thanks for explanation!

        Just make sure that this is landed after https://crrev.com/c/7614912

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Shaobo Yan
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
          Gerrit-Change-Number: 7035392
          Gerrit-PatchSet: 7
          Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
          Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
          Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
          Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
          Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
          Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
          Gerrit-Comment-Date: Mon, 02 Mar 2026 09:14:17 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Shaobo Yan (Gerrit)

          unread,
          2:39 AM (15 hours ago) 2:39 AM
          to Ilya Nikolaevskiy, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
          Attention needed from Sunny Sachanandani

          Shaobo Yan added 4 comments

          File gpu/ipc/common/dxgi_helpers.cc
          Line 296, Patchset 7: base::WaitableEvent event(

          base::WaitableEvent::ResetPolicy::AUTOMATIC,
          base::WaitableEvent::InitialState::NOT_SIGNALED);
          Sunny Sachanandani . resolved

          Just use the default params here - we don't really care about the event being reset which is also a bit dangerous since it can lead to an infinite wait

          Shaobo Yan

          Done

          Line 303, Patchset 7: device_context->Flush();
          Sunny Sachanandani . resolved

          I believe EnqueueSetEvent guarantees a flush and if it fails, it probably means the device is lost and flushing won't really do anything.

          Shaobo Yan

          Done

          File media/capture/video/win/video_capture_device_mf_win.cc
          Line 722, Patchset 7: base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
          base::WaitableEvent::InitialState::NOT_SIGNALED);
          Sunny Sachanandani . resolved

          Same here - the default params are what you want.

          Shaobo Yan

          Done

          Line 731, Patchset 7: device_context->Flush();
          Sunny Sachanandani . resolved

          And here - we don't want to flush if EnqueueSetEvent fails - that means something catastrophic has happened to the D3D11 device.

          Shaobo Yan

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Sunny Sachanandani
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
            Gerrit-Change-Number: 7035392
            Gerrit-PatchSet: 8
            Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
            Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
            Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
            Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-Comment-Date: Thu, 05 Mar 2026 07:39:34 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Sunny Sachanandani <sun...@chromium.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Shaobo Yan (Gerrit)

            unread,
            2:40 AM (15 hours ago) 2:40 AM
            to Chromium IPC Reviews, Ilya Nikolaevskiy, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
            Attention needed from Chromium IPC Reviews and Sunny Sachanandani

            Shaobo Yan added 1 comment

            Patchset-level comments
            File-level comment, Patchset 8 (Latest):
            Shaobo Yan . resolved

            PTAL the ipc part changes, thanks!

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Chromium IPC Reviews
            • Sunny Sachanandani
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
            Gerrit-Change-Number: 7035392
            Gerrit-PatchSet: 8
            Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Chromium IPC Reviews <chrome-ip...@google.com>
            Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
            Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
            Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
            Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-Attention: Chromium IPC Reviews <chrome-ip...@google.com>
            Gerrit-Comment-Date: Thu, 05 Mar 2026 07:40:20 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            gwsq (Gerrit)

            unread,
            2:42 AM (15 hours ago) 2:42 AM
            to Shaobo Yan, Chromium IPC Reviews, Will Harris, Ilya Nikolaevskiy, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
            Attention needed from Sunny Sachanandani and Will Harris

            Message from gwsq

            From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
            IPC: w...@chromium.org

            📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).

            IPC reviewer(s): w...@chromium.org


            Reviewer source(s):
            w...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Sunny Sachanandani
            • Will Harris
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
            Gerrit-Change-Number: 7035392
            Gerrit-PatchSet: 8
            Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
            Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-Reviewer: Will Harris <w...@chromium.org>
            Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
            Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
            Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
            Gerrit-CC: gwsq
            Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-Attention: Will Harris <w...@chromium.org>
            Gerrit-Comment-Date: Thu, 05 Mar 2026 07:42:21 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Will Harris (Gerrit)

            unread,
            12:06 PM (5 hours ago) 12:06 PM
            to Shaobo Yan, Will Harris, Chromium IPC Reviews, Ilya Nikolaevskiy, Qiu, Jianlin, Sunny Sachanandani, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, geoffla...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
            Attention needed from Shaobo Yan and Sunny Sachanandani

            Will Harris voted Code-Review+1

            Code-Review+1
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Shaobo Yan
            • Sunny Sachanandani
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement 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: I91fae57f566fa2016bf0e37bc0960fb737168db8
            Gerrit-Change-Number: 7035392
            Gerrit-PatchSet: 8
            Gerrit-Owner: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Ilya Nikolaevskiy <il...@chromium.org>
            Gerrit-Reviewer: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-Reviewer: Will Harris <w...@chromium.org>
            Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
            Gerrit-CC: Qiu, Jianlin <jianl...@intel.com>
            Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
            Gerrit-CC: gwsq
            Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
            Gerrit-Attention: Shaobo Yan <shao...@microsoft.com>
            Gerrit-Comment-Date: Thu, 05 Mar 2026 17:06:30 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            open
            diffy
            Reply all
            Reply to author
            Forward
            0 new messages