Title: [294630] trunk/Source
- Revision
- 294630
- Author
- [email protected]
- Date
- 2022-05-23 03:34:25 -0700 (Mon, 23 May 2022)
Log Message
Add a runtime setting for switching on/off AudioSampleDataSource buffer adaptation
https://bugs.webkit.org/show_bug.cgi?id=240634
Patch by Youenn Fablet <[email protected]> on 2022-05-23
Reviewed by Eric Carlson.
* Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml:
* Source/WebCore/page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCAudioLatencyAdaptationEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCAudioLatencyAdaptationEnabled):
* Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.mm:
(WebCore::AudioSampleDataConverter::updateBufferedAmount):
Canonical link: https://commits.webkit.org/250856@main
Modified Paths
Diff
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (294629 => 294630)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-05-23 09:06:26 UTC (rev 294629)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-05-23 10:34:25 UTC (rev 294630)
@@ -976,6 +976,17 @@
WebKit:
default: false
+WebRTCAudioLatencyAdaptationEnabled:
+ type: bool
+ humanReadableName: "WebRTC Audio Latency Adaptation"
+ humanReadableDescription: "Enable WebRTC Audio Latency Adaptation"
+ webcoreBinding: RuntimeEnabledFeatures
+ defaultValue:
+ WebKitLegacy:
+ default: true
+ WebKit:
+ default: true
+
# FIXME: Is this implemented for WebKitLegacy? If not, this should be excluded from WebKitLegacy entirely.
WebRTCDTMFEnabled:
type: bool
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (294629 => 294630)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2022-05-23 09:06:26 UTC (rev 294629)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2022-05-23 10:34:25 UTC (rev 294630)
@@ -150,6 +150,8 @@
bool webRTCPlatformUDPSocketsEnabled() const { return m_isWebRTCPlatformUDPSocketsEnabled; }
void setWebRTCPlatformUDPSocketsEnabled(bool isEnabled) { m_isWebRTCPlatformUDPSocketsEnabled = isEnabled; }
#endif
+ bool webRTCAudioLatencyAdaptationEnabled() const { return m_isWebRTCAudioLatencyAdaptationEnabled; }
+ void setWebRTCAudioLatencyAdaptationEnabled(bool isEnabled) { m_isWebRTCAudioLatencyAdaptationEnabled = isEnabled; }
#if ENABLE(DATALIST_ELEMENT)
bool dataListElementEnabled() const { return m_isDataListElementEnabled; }
@@ -314,6 +316,7 @@
bool m_isWebRTCPlatformTCPSocketsEnabled { false };
bool m_isWebRTCPlatformUDPSocketsEnabled { false };
#endif
+ bool m_isWebRTCAudioLatencyAdaptationEnabled { true };
#if ENABLE(DATALIST_ELEMENT)
bool m_isDataListElementEnabled { false };
Modified: trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.h (294629 => 294630)
--- trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.h 2022-05-23 09:06:26 UTC (rev 294629)
+++ trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.h 2022-05-23 10:34:25 UTC (rev 294630)
@@ -38,7 +38,7 @@
class AudioSampleDataConverter {
WTF_MAKE_FAST_ALLOCATED;
public:
- AudioSampleDataConverter() = default;
+ AudioSampleDataConverter();
~AudioSampleDataConverter();
OSStatus setFormats(const CAAudioStreamDescription& inputDescription, const CAAudioStreamDescription& outputDescription);
@@ -66,6 +66,7 @@
AudioConverterRef m_audioConverter { nullptr };
};
+ bool m_latencyAdaptationEnabled { true };
Converter m_lowConverter;
Converter m_regularConverter;
Converter m_highConverter;
Modified: trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.mm (294629 => 294630)
--- trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.mm 2022-05-23 09:06:26 UTC (rev 294629)
+++ trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.mm 2022-05-23 10:34:25 UTC (rev 294630)
@@ -28,11 +28,17 @@
#import "AudioSampleBufferList.h"
#import "Logging.h"
+#import "RuntimeEnabledFeatures.h"
#import <AudioToolbox/AudioConverter.h>
#import <pal/cf/AudioToolboxSoftLink.h>
namespace WebCore {
+AudioSampleDataConverter::AudioSampleDataConverter()
+ : m_latencyAdaptationEnabled(RuntimeEnabledFeatures::sharedFeatures().webRTCAudioLatencyAdaptationEnabled())
+{
+}
+
AudioSampleDataConverter::~AudioSampleDataConverter()
{
}
@@ -75,6 +81,9 @@
bool AudioSampleDataConverter::updateBufferedAmount(size_t currentBufferedAmount, size_t pushedSampleSize)
{
+ if (!m_latencyAdaptationEnabled)
+ return !!m_selectedConverter;
+
if (currentBufferedAmount) {
if (m_selectedConverter == m_regularConverter) {
if (currentBufferedAmount <= m_lowBufferSize) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes