Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Audio playback rate sped up for few seconds when using createMediaEle…
…mentSource https://bugs.webkit.org/show_bug.cgi?id=239696 <rdar://problem/92569332> Reviewed by Eric Carlson. We added a way for AudioSampleDataSource to reduce latency due to its audio buffer by reading the audio buffer faster until the audio buffer size decreases to a reasonnable value. The reasonnable buffer size was computed in terms of multiple of 10ms as RTC sources are pushing 10 or 20 millisecond chunks. Other sources may push much bigger chunks (100 milliseconds for instance), in which case it does not make real sense to try to reduce the delay below it. To prevent this, we will decrease the buffer size if it is above 100 milliseconds (as previously) AND the buffer size is 4 times the size of the pushed audio chunk. 4 times the size of the pushed audio chunk is 40 ms for RTC sources which is a reasonnable buffer size. Manually tested with https://webaudioapi.com/samples/audio-tag/. * platform/audio/cocoa/AudioSampleDataConverter.h: * platform/audio/cocoa/AudioSampleDataConverter.mm: (WebCore::AudioSampleDataConverter::updateBufferedAmount): * platform/audio/cocoa/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pushSamplesInternal): Canonical link: https://commits.webkit.org/250579@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information