Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292994 => 292995)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-04-19 00:49:57 UTC (rev 292994)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-04-19 00:50:01 UTC (rev 292995)
@@ -1,5 +1,48 @@
2022-04-18 Kocsen Chung <kocsen_ch...@apple.com>
+ Cherry-pick r292563. rdar://problem/88969850
+
+ (Safari 15 - iOS15): Increased audio latency on streaming via webrtc
+ https://bugs.webkit.org/show_bug.cgi?id=236363
+ <rdar://problem/88969850>
+
+ Reviewed by Eric Carlson.
+
+ On macOS 12.3, the default preferred buffer size is roughly 100 ms.
+ This is ok for regular audio playback but is not desirable when playing realtime audio.
+ To reduce the perceived latency, we now reduce the preferred buffer size to 20ms
+ whenever playing an audio MediaStreamTrack, similarly to when capturing audio.
+
+ Manually tested.
+
+ * platform/audio/PlatformMediaSession.cpp:
+ * platform/audio/PlatformMediaSession.h:
+ * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-04-07 Youenn Fablet <you...@apple.com>
+
+ (Safari 15 - iOS15): Increased audio latency on streaming via webrtc
+ https://bugs.webkit.org/show_bug.cgi?id=236363
+ <rdar://problem/88969850>
+
+ Reviewed by Eric Carlson.
+
+ On macOS 12.3, the default preferred buffer size is roughly 100 ms.
+ This is ok for regular audio playback but is not desirable when playing realtime audio.
+ To reduce the perceived latency, we now reduce the preferred buffer size to 20ms
+ whenever playing an audio MediaStreamTrack, similarly to when capturing audio.
+
+ Manually tested.
+
+ * platform/audio/PlatformMediaSession.cpp:
+ * platform/audio/PlatformMediaSession.h:
+ * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+
+2022-04-18 Kocsen Chung <kocsen_ch...@apple.com>
+
Cherry-pick r292560. rdar://problem/90924861
Iterate over copy of animated properties in WebCore::WebAnimation::commitStyles
Modified: branches/safari-613-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp (292994 => 292995)
--- branches/safari-613-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2022-04-19 00:49:57 UTC (rev 292994)
+++ branches/safari-613-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2022-04-19 00:50:01 UTC (rev 292995)
@@ -365,6 +365,11 @@
return m_client.canProduceAudio();
}
+bool PlatformMediaSession::hasMediaStreamSource() const
+{
+ return m_client.hasMediaStreamSource();
+}
+
void PlatformMediaSession::canProduceAudioChanged()
{
PlatformMediaSessionManager::sharedManager().sessionCanProduceAudioChanged();
Modified: branches/safari-613-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (292994 => 292995)
--- branches/safari-613-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2022-04-19 00:49:57 UTC (rev 292994)
+++ branches/safari-613-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2022-04-19 00:50:01 UTC (rev 292995)
@@ -179,6 +179,7 @@
bool activeAudioSessionRequired() const;
bool canProduceAudio() const;
+ bool hasMediaStreamSource() const;
void canProduceAudioChanged();
virtual void resetPlaybackSessionState() { }
Modified: branches/safari-613-branch/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (292994 => 292995)
--- branches/safari-613-branch/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2022-04-19 00:49:57 UTC (rev 292994)
+++ branches/safari-613-branch/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2022-04-19 00:50:01 UTC (rev 292995)
@@ -99,6 +99,7 @@
int videoAudioCount = 0;
int audioCount = 0;
int webAudioCount = 0;
+ int audioMediaStreamTrackCount = 0;
int captureCount = countActiveAudioCaptureSources();
bool hasAudibleAudioOrVideoMediaType = false;
bool isPlayingAudio = false;
@@ -112,9 +113,13 @@
break;
case PlatformMediaSession::MediaType::VideoAudio:
++videoAudioCount;
+ if (session.canProduceAudio() && session.hasMediaStreamSource())
+ ++audioMediaStreamTrackCount;
break;
case PlatformMediaSession::MediaType::Audio:
++audioCount;
+ if (session.canProduceAudio() && session.hasMediaStreamSource())
+ ++audioMediaStreamTrackCount;
break;
case PlatformMediaSession::MediaType::WebAudio:
if (session.canProduceAudio()) {
@@ -138,6 +143,7 @@
ALWAYS_LOG(LOGIDENTIFIER, "types: "
"AudioCapture(", captureCount, "), "
+ "AudioTrack(", audioMediaStreamTrackCount, "), "
"Video(", videoCount, "), "
"Audio(", audioCount, "), "
"VideoAudio(", videoAudioCount, "), "
@@ -146,8 +152,8 @@
size_t bufferSize = m_defaultBufferSize;
if (webAudioCount)
bufferSize = AudioUtilities::renderQuantumSize;
- else if (captureCount) {
- // In case of audio capture, we want to grab 20 ms chunks to limit the latency so that it is not noticeable by users
+ else if (captureCount || audioMediaStreamTrackCount) {
+ // In case of audio capture or audio MediaStreamTrack playing, we want to grab 20 ms chunks to limit the latency so that it is not noticeable by users
// while having a large enough buffer so that the audio rendering remains stable, hence a computation based on sample rate.
bufferSize = AudioSession::sharedSession().sampleRate() / 50;
} else if (m_supportedAudioHardwareBufferSizes && DeprecatedGlobalSettings::lowPowerVideoAudioBufferSizeEnabled())