MediaElementAudioSourceNode should account for preservesPitch when resampling for playback rate#61548
Closed
Ahmad-S792 wants to merge 1 commit into
Conversation
…sampling for playback rate https://bugs.webkit.org/show_bug.cgi?id=310951 rdar://173564158 Reviewed by NOBODY (OOPS!). The commit 310098@main added playback rate resampling in MediaElementAudioSourceNode so that pitch shifts correctly when preservesPitch=false and the element is connected to an AudioContext via createMediaElementSource(). However, the resampling was applied unconditionally, which also shifted pitch when preservesPitch=true. The MTAudioProcessingTap captures decoded audio before AVFoundation's time-pitch algorithm runs, so the AudioContext always receives the original pitch. The resampler must therefore only apply the playback rate factor when preservesPitch is false; when true, the user expects the original pitch regardless of playback rate. Add setPreservesPitch() to MediaElementAudioSourceNode and have HTMLMediaElement notify it when the flag changes. In updateResamplerIfNeeded(), use the playback rate as a resampling factor only when preservesPitch is false. With 310098@main, we progressed two subtests in `preserves-pitch.html` WPT but regressed two as well (preservesPitch=true) cases. Now, this patch fixes them and unskip whole test altogether. * LayoutTests/TestExpectations: Unskip (if unskipped, it would have caught the issue before) * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/preserves-pitch-expected.txt: * Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::setPreservesPitch): (WebCore::MediaElementAudioSourceNode::updateResamplerIfNeeded): * Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.h: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setPreservesPitch):
Collaborator
|
EWS run on current version of this PR (hash 46cbc7d) Details
|
Contributor
Author
|
This is flaky. :-( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 mac-apple
46cbc7d
46cbc7d