[webaudio]: Fix AudioBufferSourceNode duration behavior when looping [chromium/src : main]

0 views
Skip to first unread message

AI Code Reviewer (Gerrit)

unread,
Mar 6, 2026, 11:43:11 PMMar 6
to Mahesh Kannan, chromium...@chromium.org, Hongchan Choi, blink-revie...@chromium.org, blink-...@chromium.org

AI Code Reviewer added 1 comment

File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.h
Line 171, Patchset 1 (Latest): double buffer_played_time() const {
AI Code Reviewer . unresolved

Blink Style Guide: Naming - Use 'CamelCase' for all function names. Function 'buffer_played_time' should be named 'BufferPlayedTime'.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Open in Gerrit

Related details

Attention set is empty
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: I81d4cad73b28f953a5d5dd99878815704762de29
Gerrit-Change-Number: 7644896
Gerrit-PatchSet: 1
Gerrit-Owner: Mahesh Kannan <kmah...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Hongchan Choi <hong...@chromium.org>
Gerrit-CC: Michael Wilson <mjwi...@chromium.org>
Gerrit-Comment-Date: Sat, 07 Mar 2026 04:43:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mahesh Kannan (Gerrit)

unread,
Mar 6, 2026, 11:59:13 PMMar 6
to AI Code Reviewer, chromium...@chromium.org, Hongchan Choi, blink-revie...@chromium.org, blink-...@chromium.org

Mahesh Kannan added 1 comment

File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.h
Line 171, Patchset 1: double buffer_played_time() const {
AI Code Reviewer . resolved

Blink Style Guide: Naming - Use 'CamelCase' for all function names. Function 'buffer_played_time' should be named 'BufferPlayedTime'.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Mahesh Kannan

Done

Open in Gerrit

Related details

Attention set is empty
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: I81d4cad73b28f953a5d5dd99878815704762de29
    Gerrit-Change-Number: 7644896
    Gerrit-PatchSet: 2
    Gerrit-Owner: Mahesh Kannan <kmah...@google.com>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: Hongchan Choi <hong...@chromium.org>
    Gerrit-CC: Michael Wilson <mjwi...@chromium.org>
    Gerrit-Comment-Date: Sat, 07 Mar 2026 04:59:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Wilson (Gerrit)

    unread,
    Mar 10, 2026, 5:46:55 PMMar 10
    to Mahesh Kannan, Hongchan Choi, Chromium LUCI CQ, AI Code Reviewer, chromium...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Mahesh Kannan

    Michael Wilson added 6 comments

    Patchset-level comments
    File-level comment, Patchset 3 (Latest):
    Michael Wilson . resolved

    Thank you, the overall approach looks good but I have some concerns about numerical issues and robustness.

    File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.h
    Line 171, Patchset 3 (Latest): double BufferPlayedTime() const {
    Michael Wilson . unresolved

    Is this used anywhere? If not, let's remove it.

    File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.cc
    Line 271, Patchset 3 (Latest): std::ceil(source_frames_left / std::abs(computed_playback_rate));
    Michael Wilson . unresolved

    If the magnitude of `computed_playback_rate` is very large we may not be able to convert to `int` successfully here. Gemini suggested doing the comparison with `double` first, only casting inside the `if` block.

    Line 415, Patchset 3 (Latest): buffer_played_frames_ +=
    Michael Wilson . unresolved

    Could there be numerical precision issues with accumulating in this way?

    Line 421, Patchset 3 (Latest): UNSAFE_TODO(memset(
    Michael Wilson . unresolved

    Ideally we shouldn't introduce new unsafe operations. Perhaps we should land some pre-work to convert `destination_channels_` into spans.

    Line 521, Patchset 3 (Latest): // We're looping a grain with a grain duration specified. The node will stop
    Michael Wilson . unresolved

    Did this comment get cut off?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mahesh Kannan
    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: I81d4cad73b28f953a5d5dd99878815704762de29
      Gerrit-Change-Number: 7644896
      Gerrit-PatchSet: 3
      Gerrit-Owner: Mahesh Kannan <kmah...@google.com>
      Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
      Gerrit-Reviewer: Mahesh Kannan <kmah...@google.com>
      Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Attention: Mahesh Kannan <kmah...@google.com>
      Gerrit-Comment-Date: Tue, 10 Mar 2026 21:46:45 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mahesh Kannan (Gerrit)

      unread,
      Mar 11, 2026, 1:36:17 PMMar 11
      to Hongchan Choi, Chromium LUCI CQ, AI Code Reviewer, chromium...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

      Mahesh Kannan added 3 comments

      File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.h
      Line 171, Patchset 3: double BufferPlayedTime() const {
      Michael Wilson . resolved

      Is this used anywhere? If not, let's remove it.

      Mahesh Kannan

      Removed, I added that incase we need to add the information for debugging `duration` issues

      File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.cc
      Line 271, Patchset 3: std::ceil(source_frames_left / std::abs(computed_playback_rate));
      Michael Wilson . resolved

      If the magnitude of `computed_playback_rate` is very large we may not be able to convert to `int` successfully here. Gemini suggested doing the comparison with `double` first, only casting inside the `if` block.

      Mahesh Kannan

      Done

      Line 521, Patchset 3: // We're looping a grain with a grain duration specified. The node will stop
      Michael Wilson . resolved

      Did this comment get cut off?

      Mahesh Kannan

      Done

      Open in Gerrit

      Related details

      Attention set is empty
      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: I81d4cad73b28f953a5d5dd99878815704762de29
      Gerrit-Change-Number: 7644896
      Gerrit-PatchSet: 5
      Gerrit-Owner: Mahesh Kannan <kmah...@google.com>
      Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
      Gerrit-Reviewer: Mahesh Kannan <kmah...@google.com>
      Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Comment-Date: Wed, 11 Mar 2026 17:36:07 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Michael Wilson <mjwi...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mahesh Kannan (Gerrit)

      unread,
      Mar 26, 2026, 6:14:35 PMMar 26
      to Hongchan Choi, Chromium LUCI CQ, AI Code Reviewer, chromium...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

      Mahesh Kannan added 1 comment

      File third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.cc
      Line 421, Patchset 3: UNSAFE_TODO(memset(
      Michael Wilson . resolved

      Ideally we shouldn't introduce new unsafe operations. Perhaps we should land some pre-work to convert `destination_channels_` into spans.

      Mahesh Kannan

      Done

      Open in Gerrit

      Related details

      Attention set is empty
      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: I81d4cad73b28f953a5d5dd99878815704762de29
      Gerrit-Change-Number: 7644896
      Gerrit-PatchSet: 6
      Gerrit-Owner: Mahesh Kannan <kmah...@google.com>
      Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
      Gerrit-Reviewer: Mahesh Kannan <kmah...@google.com>
      Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Comment-Date: Thu, 26 Mar 2026 22:14:26 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages