Spanify WebAudioSourceProvider::ProvideInput audio_data parameter [chromium/src : main]

2 views
Skip to first unread message

kelsen liu (Gerrit)

unread,
Feb 26, 2026, 9:30:04 AM (2 days ago) Feb 26
to Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, Hongchan Choi, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
Attention needed from Kent Tamura

kelsen liu added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
kelsen liu . resolved

Hi Kent, please take a look, thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Kent Tamura
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: Ic78df13d2c30628133aacf0da6ac46e494439628
Gerrit-Change-Number: 7611048
Gerrit-PatchSet: 2
Gerrit-Owner: kelsen liu <kels...@chromium.org>
Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
Gerrit-CC: Hongchan Choi <hong...@chromium.org>
Gerrit-CC: Michael Wilson <mjwi...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Kent Tamura <tk...@chromium.org>
Gerrit-Comment-Date: Thu, 26 Feb 2026 14:29:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Kent Tamura (Gerrit)

unread,
Feb 26, 2026, 5:31:24 PM (2 days ago) Feb 26
to kelsen liu, Hongchan Choi, Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
Attention needed from Hongchan Choi and kelsen liu

Kent Tamura voted and added 1 comment

Votes added by Kent Tamura

Code-Review+1

1 comment

Patchset-level comments
Kent Tamura . resolved

LGTM. Please ask a webaudio/OWNERS for review too.

Open in Gerrit

Related details

Attention is currently required from:
  • Hongchan Choi
  • kelsen liu
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: Ic78df13d2c30628133aacf0da6ac46e494439628
Gerrit-Change-Number: 7611048
Gerrit-PatchSet: 2
Gerrit-Owner: kelsen liu <kels...@chromium.org>
Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
Gerrit-CC: Michael Wilson <mjwi...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
Gerrit-Attention: kelsen liu <kels...@chromium.org>
Gerrit-Comment-Date: Thu, 26 Feb 2026 22:30:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

kelsen liu (Gerrit)

unread,
Feb 26, 2026, 9:29:27 PM (2 days ago) Feb 26
to Hongchan Choi, Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
Attention needed from Hongchan Choi

kelsen liu added 1 comment

Patchset-level comments
Kent Tamura . resolved

LGTM. Please ask a webaudio/OWNERS for review too.

kelsen liu

Thanks for the review!

Open in Gerrit

Related details

Attention is currently required from:
  • Hongchan Choi
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: Ic78df13d2c30628133aacf0da6ac46e494439628
Gerrit-Change-Number: 7611048
Gerrit-PatchSet: 2
Gerrit-Owner: kelsen liu <kels...@chromium.org>
Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
Gerrit-CC: Michael Wilson <mjwi...@chromium.org>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
Gerrit-Comment-Date: Fri, 27 Feb 2026 02:29:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kent Tamura <tk...@chromium.org>
satisfied_requirement
open
diffy

Hongchan Choi (Gerrit)

unread,
Feb 27, 2026, 10:10:13 AM (yesterday) Feb 27
to kelsen liu, Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
Attention needed from Michael Wilson and kelsen liu

Hongchan Choi added 5 comments

Patchset-level comments
Hongchan Choi . resolved

Thanks for cleaning these up!

Generally looks good, but allocating something new in the audio hot path is not recommended so I made some suggestions.

Also adding mjwilson@ since he was looking into spanification of audio code.

File third_party/blink/renderer/platform/mediastream/media_stream_web_audio_source.h
Line 59, Patchset 2 (Latest): std::unique_ptr<WebAudioSourceProvider> web_audio_source_provider_;
Hongchan Choi . unresolved
```suggestion
std::unique_ptr<WebAudioSourceProvider> web_audio_source_provider_;
  // Re-allocate only when the channel count changes to avoid heap
// allocations on the real-time audio thread.
std::vector<base::span<float>> web_audio_data_;
```
File third_party/blink/renderer/platform/mediastream/media_stream_web_audio_source.cc
Line 61, Patchset 2 (Latest): std::vector<base::span<float>> web_audio_data(static_cast<size_t>(n));
Hongchan Choi . unresolved
```suggestion
if (web_audio_data_.size() != n) {
web_audio_data_.resize(static_cast<size_t>(n));
}

```

Line 63, Patchset 2 (Latest): web_audio_data[i] = bus->Channel(i)->MutableSpan().first(
Hongchan Choi . unresolved
```suggestion
web_audio_data_[i] = bus->Channel(i)->MutableSpan().first(
```
Line 67, Patchset 2 (Latest): web_audio_source_provider_->ProvideInput(web_audio_data, frames_to_process);
Hongchan Choi . unresolved
```suggestion
web_audio_source_provider_->ProvideInput(web_audio_data_, frames_to_process);
```
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Wilson
  • kelsen liu
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: Ic78df13d2c30628133aacf0da6ac46e494439628
    Gerrit-Change-Number: 7611048
    Gerrit-PatchSet: 2
    Gerrit-Owner: kelsen liu <kels...@chromium.org>
    Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
    Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
    Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
    Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: Michael Wilson <mjwi...@chromium.org>
    Gerrit-Attention: kelsen liu <kels...@chromium.org>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 15:10:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Wilson (Gerrit)

    unread,
    Feb 27, 2026, 2:15:30 PM (yesterday) Feb 27
    to kelsen liu, Hongchan Choi, Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
    Attention needed from kelsen liu

    Michael Wilson added 1 comment

    Patchset-level comments
    Michael Wilson . resolved

    Thank you for this work! I agree with the performance comments Hongchan added; no further requests from me. The span methods in AudioChannel will help my current work, so looking forward to this patch landing.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • kelsen liu
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: Ic78df13d2c30628133aacf0da6ac46e494439628
    Gerrit-Change-Number: 7611048
    Gerrit-PatchSet: 2
    Gerrit-Owner: kelsen liu <kels...@chromium.org>
    Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
    Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
    Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
    Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: kelsen liu <kels...@chromium.org>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 19:15:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    kelsen liu (Gerrit)

    unread,
    2:14 AM (19 hours ago) 2:14 AM
    to Hongchan Choi, Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
    Attention needed from Hongchan Choi and Michael Wilson

    kelsen liu added 5 comments

    Patchset-level comments
    Michael Wilson . resolved

    Thank you for this work! I agree with the performance comments Hongchan added; no further requests from me. The span methods in AudioChannel will help my current work, so looking forward to this patch landing.

    kelsen liu

    Thanks for the review!

    Hongchan Choi . resolved

    Thanks for cleaning these up!

    Generally looks good, but allocating something new in the audio hot path is not recommended so I made some suggestions.

    Also adding mjwilson@ since he was looking into spanification of audio code.

    kelsen liu

    Thanks for the review.

    The reasons I initially removed the web_audio_data_ member variable were:

    If we keep it as a class member, the linter requires it to be defined as `std::vector<base::raw_span<float>>`. However, `std::vector<base::raw_span<float>>` and `std::vector<base::span<float>>` (which is expected by the function signature) are different types and cannot be implicitly converted.

    I referred to the existing implementation in `HTMLMediaElement::AudioSourceProviderImpl::ProvideInput`, which uses `web_audio_data` as a local variable. I assumed that since the audio channel count is quite limited, the overhead of allocating a small vector might be acceptable here.

    To strictly avoid frequent memory allocations on the audio hot path, I have restored the member variable and applied `RAW_PTR_EXCLUSION std::vector<base::span<float>>` to fix this in the updated code.

    Could you please take another look? Thanks!

    File third_party/blink/renderer/platform/mediastream/media_stream_web_audio_source.cc
    Line 61, Patchset 2: std::vector<base::span<float>> web_audio_data(static_cast<size_t>(n));
    Hongchan Choi . resolved
    ```suggestion
    if (web_audio_data_.size() != n) {
    web_audio_data_.resize(static_cast<size_t>(n));
    }

    ```

    kelsen liu

    Done

    Line 63, Patchset 2: web_audio_data[i] = bus->Channel(i)->MutableSpan().first(
    Hongchan Choi . resolved
    ```suggestion
    web_audio_data_[i] = bus->Channel(i)->MutableSpan().first(
    ```
    kelsen liu

    Done

    Line 67, Patchset 2: web_audio_source_provider_->ProvideInput(web_audio_data, frames_to_process);
    Hongchan Choi . resolved
    ```suggestion
    web_audio_source_provider_->ProvideInput(web_audio_data_, frames_to_process);
    ```
    kelsen liu

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hongchan Choi
    • Michael Wilson
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement 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: Ic78df13d2c30628133aacf0da6ac46e494439628
      Gerrit-Change-Number: 7611048
      Gerrit-PatchSet: 5
      Gerrit-Owner: kelsen liu <kels...@chromium.org>
      Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
      Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
      Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
      Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
      Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
      Gerrit-Attention: Michael Wilson <mjwi...@chromium.org>
      Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
      Gerrit-Comment-Date: Sat, 28 Feb 2026 07:14:36 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Michael Wilson <mjwi...@chromium.org>
      Comment-In-Reply-To: Hongchan Choi <hong...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      kelsen liu (Gerrit)

      unread,
      2:15 AM (19 hours ago) 2:15 AM
      to Hongchan Choi, Kent Tamura, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org, kinuko...@chromium.org, tommyw+w...@chromium.org
      Attention needed from Hongchan Choi and Michael Wilson

      kelsen liu added 1 comment

      File third_party/blink/renderer/platform/mediastream/media_stream_web_audio_source.h
      Line 59, Patchset 2: std::unique_ptr<WebAudioSourceProvider> web_audio_source_provider_;
      Hongchan Choi . resolved
      ```suggestion
      std::unique_ptr<WebAudioSourceProvider> web_audio_source_provider_;
        // Re-allocate only when the channel count changes to avoid heap
      // allocations on the real-time audio thread.
        std::vector<base::span<float>> web_audio_data_;
      ```
      kelsen liu

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hongchan Choi
      • Michael Wilson
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement 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: Ic78df13d2c30628133aacf0da6ac46e494439628
        Gerrit-Change-Number: 7611048
        Gerrit-PatchSet: 5
        Gerrit-Owner: kelsen liu <kels...@chromium.org>
        Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
        Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
        Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
        Gerrit-Reviewer: kelsen liu <kels...@chromium.org>
        Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
        Gerrit-Attention: Michael Wilson <mjwi...@chromium.org>
        Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
        Gerrit-Comment-Date: Sat, 28 Feb 2026 07:15:01 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Hongchan Choi <hong...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages