Bug 239696 - Audio playback rate sped up for few seconds when using createMediaElementSource
Summary: Audio playback rate sped up for few seconds when using createMediaElementSource
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: Safari 15
Hardware: All All
: P2 Major
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-23 14:46 PDT by Luigi Pulcini
Modified: 2022-05-15 23:38 PDT (History)
16 users (show)

See Also:


Attachments
Patch (4.86 KB, patch)
2022-05-12 02:47 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (4.86 KB, patch)
2022-05-12 06:54 PDT, youenn fablet
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (5.12 KB, patch)
2022-05-14 11:41 PDT, youenn fablet
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (41.69 KB, patch)
2022-05-15 22:38 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (6.43 KB, patch)
2022-05-15 22:41 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luigi Pulcini 2022-04-23 14:46:12 PDT
Several customers of my plugin WavePlayer are reporting that audio playback in Safari 15 and iOS 15 is "sped up" for a few seconds before settling to the correct rate.
I have just tested this on my MacBookPro with Mac OS 10.15.7 and Safari 15.4 using the simplest createMediaElementSource implementation you could possibly think of (a 16-line script) and can confirm the bad behavior only in Safari, while Chrome, Firefox, and Edge are not affected.

You can test this at the following address:
https://webaudioapi.com/samples/audio-tag/
Comment 1 Tero Parviainen 2022-04-25 08:20:18 PDT
Confirming I'm also seeing the same behaviour on OS X 12.3.1, Safari 15.4.

The speeding-up happens reliably at the beginning, and seems to reoccur occasionally well into the playback. 

The same happens both when starting playback with the element already attached into the web audio graph, and when connecting a previously started element.
Comment 2 Jeffrey Alan Scudder 2022-04-25 20:35:10 PDT
Yes I see this behavior when trying to use createMediaElementSource on both iOS and Safari, with both video and audio tags. I think it happens across the board. Also, the audio is delayed significantly in the context of using a video tag.
Comment 3 Radar WebKit Bug Importer 2022-04-30 14:47:13 PDT
<rdar://problem/92569332>
Comment 4 youenn fablet 2022-05-12 02:47:50 PDT
Created attachment 459215 [details]
Patch
Comment 5 Eric Carlson 2022-05-12 06:18:22 PDT
Comment on attachment 459215 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=459215&action=review

> Source/WebCore/ChangeLog:9
> +        We added a way for AudioSampleDataSource to reduce latemcy due to its audio buffer by reading the audio buffer faster

s/latemcy/latency/
Comment 6 youenn fablet 2022-05-12 06:54:16 PDT
Created attachment 459229 [details]
Patch for landing
Comment 7 EWS 2022-05-13 00:45:29 PDT
Eric Carslon found in /Volumes/Data/worker/Commit-Queue/build/Source/WebCore/ChangeLog does not appear to be a valid reviewer according to contributors.json.
/Volumes/Data/worker/Commit-Queue/build/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).
Comment 8 youenn fablet 2022-05-14 11:41:58 PDT
Created attachment 459359 [details]
Patch for landing
Comment 9 youenn fablet 2022-05-15 22:38:35 PDT
Created attachment 459394 [details]
Patch for landing
Comment 10 youenn fablet 2022-05-15 22:41:18 PDT
Created attachment 459396 [details]
Patch for landing
Comment 11 EWS 2022-05-15 23:38:31 PDT
Committed r294221 (250579@main): <https://commits.webkit.org/250579@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 459396 [details].