UseSharedImageInOOPVDProcess: ImportSharedImage when decoder destructs [chromium/src : main]

0 views
Skip to first unread message

Kramer Ge (Gerrit)

unread,
Dec 2, 2025, 11:28:00 AM (5 days ago) Dec 2
to Vasiliy Telezhnikov, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Vasiliy Telezhnikov

Kramer Ge voted and added 1 comment

Votes added by Kramer Ge

Commit-Queue+1

1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Vasiliy Telezhnikov
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: Idbf0982b59fa312abaf8d426d1696795e0dde3c2
Gerrit-Change-Number: 7208055
Gerrit-PatchSet: 4
Gerrit-Owner: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
Gerrit-Comment-Date: Tue, 02 Dec 2025 16:27:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Vasiliy Telezhnikov (Gerrit)

unread,
Dec 2, 2025, 3:13:11 PM (4 days ago) Dec 2
to Kramer Ge, Colin Blundell, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Colin Blundell and Kramer Ge

Vasiliy Telezhnikov added 1 comment

File media/mojo/clients/mojo_video_decoder.cc
Line 107, Patchset 4 (Latest): sii->ImportSharedImage(token_to_image.second->Export());
Vasiliy Telezhnikov . unresolved

This is async operation, if the utility process will be killed before this finish, we won't be able to add the ref.

Do you know what keeps utility process alive? (i.e destruction of what object kills the process)?

Open in Gerrit

Related details

Attention is currently required from:
  • Colin Blundell
  • Kramer Ge
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: Idbf0982b59fa312abaf8d426d1696795e0dde3c2
    Gerrit-Change-Number: 7208055
    Gerrit-PatchSet: 4
    Gerrit-Owner: Kramer Ge <fang...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Colin Blundell <blun...@chromium.org>
    Gerrit-Attention: Kramer Ge <fang...@chromium.org>
    Gerrit-Comment-Date: Tue, 02 Dec 2025 20:13:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kramer Ge (Gerrit)

    unread,
    Dec 2, 2025, 3:46:46 PM (4 days ago) Dec 2
    to Colin Blundell, Vasiliy Telezhnikov, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Colin Blundell and Vasiliy Telezhnikov

    Kramer Ge added 1 comment

    File media/mojo/clients/mojo_video_decoder.cc
    Line 107, Patchset 4 (Latest): sii->ImportSharedImage(token_to_image.second->Export());
    Vasiliy Telezhnikov . unresolved

    This is async operation, if the utility process will be killed before this finish, we won't be able to add the ref.

    Do you know what keeps utility process alive? (i.e destruction of what object kills the process)?

    Kramer Ge

    `~MojoVideoDecoder` closes the mojo IPC channel, which through destruction of `MojoVideoDecoderService` in gpu process, leads to destruction of `OOPVideoDecoderService` in OOPVD process, `RenderProcessHostImpl` keeps track of the `OOPVideoDecoderService` by maintaining a list of `video_decoder_trackers_` [[1]](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_process_host_impl.h;l=1510;drc=ad0b5be27291850e9e7dd78b33fdf31949168d50;bpv=0;bpt=1). When there's 0 `tracker`s left it will kick off a timer to shutdown the oopvd process [[2]](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_process_host_impl.cc;l=2466;drc=ad0b5be27291850e9e7dd78b33fdf31949168d50;bpv=0;bpt=1).

    Since here `ImportUnownedSharedImages()` is called before `~MojoVideoDecoder` completes, and given 3s timer, this should be able to complete before utility process dies. I'm uncertain the if the IPCs between GpuChannel communication vs media mojo channel destruction are sequenced, I assume they are going through the same IO task posting.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Colin Blundell
    • Vasiliy Telezhnikov
    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: Idbf0982b59fa312abaf8d426d1696795e0dde3c2
    Gerrit-Change-Number: 7208055
    Gerrit-PatchSet: 4
    Gerrit-Owner: Kramer Ge <fang...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Colin Blundell <blun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Comment-Date: Tue, 02 Dec 2025 20:46:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Vasiliy Telezhnikov <vas...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kramer Ge (Gerrit)

    unread,
    Dec 4, 2025, 2:52:45 PM (2 days ago) Dec 4
    to Colin Blundell, Vasiliy Telezhnikov, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Colin Blundell and Vasiliy Telezhnikov

    Kramer Ge added 1 comment

    File media/mojo/clients/mojo_video_decoder.cc
    Line 107, Patchset 4 (Latest): sii->ImportSharedImage(token_to_image.second->Export());
    Vasiliy Telezhnikov . unresolved

    This is async operation, if the utility process will be killed before this finish, we won't be able to add the ref.

    Do you know what keeps utility process alive? (i.e destruction of what object kills the process)?

    Kramer Ge

    `~MojoVideoDecoder` closes the mojo IPC channel, which through destruction of `MojoVideoDecoderService` in gpu process, leads to destruction of `OOPVideoDecoderService` in OOPVD process, `RenderProcessHostImpl` keeps track of the `OOPVideoDecoderService` by maintaining a list of `video_decoder_trackers_` [[1]](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_process_host_impl.h;l=1510;drc=ad0b5be27291850e9e7dd78b33fdf31949168d50;bpv=0;bpt=1). When there's 0 `tracker`s left it will kick off a timer to shutdown the oopvd process [[2]](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_process_host_impl.cc;l=2466;drc=ad0b5be27291850e9e7dd78b33fdf31949168d50;bpv=0;bpt=1).

    Since here `ImportUnownedSharedImages()` is called before `~MojoVideoDecoder` completes, and given 3s timer, this should be able to complete before utility process dies. I'm uncertain the if the IPCs between GpuChannel communication vs media mojo channel destruction are sequenced, I assume they are going through the same IO task posting.

    Kramer Ge

    Per offline discussion I looked into how `mojom::VideoFrameHandleReleaser` and if it's possible to keep `mojom::VideoDecoderTracker` alive to prevent process shutdown. It turns out to be more complicated:

    After `~MojoVideoDecoder`, Renderer can still send `VideoFrame` releases via `mojom::VideoFrameHandleReleaser` to receiver in gpu process where `OOPVideoDecoder` will forward to the receiver in utility process. Sadly this `mojom::VideoFrameHandleReleaser` chain is broken in the gpu process because `OOPVideoDecoder` owns the `releaser` remote to the utility process, and is destroyed with renderer's decoder endpoint.

    Gerrit-Comment-Date: Thu, 04 Dec 2025 19:52:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Vasiliy Telezhnikov <vas...@chromium.org>
    Comment-In-Reply-To: Kramer Ge <fang...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kramer Ge (Gerrit)

    unread,
    Dec 5, 2025, 5:41:06 PM (2 days ago) Dec 5
    to AyeAye, Colin Blundell, Vasiliy Telezhnikov, Chromium LUCI CQ, chromium...@chromium.org, oshima...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, feature-me...@chromium.org
    Attention needed from Colin Blundell and Vasiliy Telezhnikov

    Kramer Ge voted and added 1 comment

    Votes added by Kramer Ge

    Commit-Queue+1

    1 comment

    File media/mojo/clients/mojo_video_decoder.cc
    Line 107, Patchset 4: sii->ImportSharedImage(token_to_image.second->Export());
    Vasiliy Telezhnikov . resolved

    This is async operation, if the utility process will be killed before this finish, we won't be able to add the ref.

    Do you know what keeps utility process alive? (i.e destruction of what object kills the process)?

    Kramer Ge

    `~MojoVideoDecoder` closes the mojo IPC channel, which through destruction of `MojoVideoDecoderService` in gpu process, leads to destruction of `OOPVideoDecoderService` in OOPVD process, `RenderProcessHostImpl` keeps track of the `OOPVideoDecoderService` by maintaining a list of `video_decoder_trackers_` [[1]](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_process_host_impl.h;l=1510;drc=ad0b5be27291850e9e7dd78b33fdf31949168d50;bpv=0;bpt=1). When there's 0 `tracker`s left it will kick off a timer to shutdown the oopvd process [[2]](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_process_host_impl.cc;l=2466;drc=ad0b5be27291850e9e7dd78b33fdf31949168d50;bpv=0;bpt=1).

    Since here `ImportUnownedSharedImages()` is called before `~MojoVideoDecoder` completes, and given 3s timer, this should be able to complete before utility process dies. I'm uncertain the if the IPCs between GpuChannel communication vs media mojo channel destruction are sequenced, I assume they are going through the same IO task posting.

    Kramer Ge

    Per offline discussion I looked into how `mojom::VideoFrameHandleReleaser` and if it's possible to keep `mojom::VideoDecoderTracker` alive to prevent process shutdown. It turns out to be more complicated:

    After `~MojoVideoDecoder`, Renderer can still send `VideoFrame` releases via `mojom::VideoFrameHandleReleaser` to receiver in gpu process where `OOPVideoDecoder` will forward to the receiver in utility process. Sadly this `mojom::VideoFrameHandleReleaser` chain is broken in the gpu process because `OOPVideoDecoder` owns the `releaser` remote to the utility process, and is destroyed with renderer's decoder endpoint.

    Kramer Ge

    Post PS#4, I prolonged the utility process and video_frame handle releaser lifetime.

    The caveat for this approach is that utility process can't crash before proper release as it is the sole owner of SI.

    Marking as done.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Colin Blundell
    • Vasiliy Telezhnikov
    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: Idbf0982b59fa312abaf8d426d1696795e0dde3c2
      Gerrit-Change-Number: 7208055
      Gerrit-PatchSet: 9
      Gerrit-Owner: Kramer Ge <fang...@chromium.org>
      Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
      Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
      Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
      Gerrit-Attention: Colin Blundell <blun...@chromium.org>
      Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
      Gerrit-Comment-Date: Fri, 05 Dec 2025 22:41:02 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages