Title: [293972] trunk/Source/WebCore
- Revision
- 293972
- Author
- you...@apple.com
- Date
- 2022-05-09 07:05:21 -0700 (Mon, 09 May 2022)
Log Message
CoreAudioCaptureSource::settingsDidChange should not reconfigure the audio unit if CoreAudioCaptureSource is not started
https://bugs.webkit.org/show_bug.cgi?id=240059
Reviewed by Eric Carlson.
We should only ask to reconfigure when source settings change if the source is actually started.
Otherwise, we can wait for the source to start to actually set the unit values and reconfigure if needed.
To make sure to correctly expose settings, we reset them in CoreAudioCaptureSource::settingsDidChange and in
CoreAudioCaptureSource::initializeToStartProducingData.
We also only use the audio unit sample rate if it is rendering audio, otherwise we can change the sample rate at will.
Manually tested.
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (293971 => 293972)
--- trunk/Source/WebCore/ChangeLog 2022-05-09 10:54:10 UTC (rev 293971)
+++ trunk/Source/WebCore/ChangeLog 2022-05-09 14:05:21 UTC (rev 293972)
@@ -1,3 +1,20 @@
+2022-05-09 Youenn Fablet <you...@apple.com>
+
+ CoreAudioCaptureSource::settingsDidChange should not reconfigure the audio unit if CoreAudioCaptureSource is not started
+ https://bugs.webkit.org/show_bug.cgi?id=240059
+
+ Reviewed by Eric Carlson.
+
+ We should only ask to reconfigure when source settings change if the source is actually started.
+ Otherwise, we can wait for the source to start to actually set the unit values and reconfigure if needed.
+ To make sure to correctly expose settings, we reset them in CoreAudioCaptureSource::settingsDidChange and in
+ CoreAudioCaptureSource::initializeToStartProducingData.
+ We also only use the audio unit sample rate if it is rendering audio, otherwise we can change the sample rate at will.
+
+ Manually tested.
+
+ * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+
2022-05-09 Miguel Gomez <mago...@igalia.com>
[Nicosia] Canvas animations don't work with threaded rendering
Modified: trunk/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h (293971 => 293972)
--- trunk/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h 2022-05-09 10:54:10 UTC (rev 293971)
+++ trunk/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h 2022-05-09 14:05:21 UTC (rev 293972)
@@ -81,6 +81,7 @@
void devicesChanged(const Vector<CaptureDevice>&);
void whenAudioCaptureUnitIsNotRunning(Function<void()>&&);
+ bool isRenderingAudio() const { return m_isRenderingAudio; }
protected:
void forEachClient(const Function<void(CoreAudioCaptureSource&)>&) const;
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (293971 => 293972)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2022-05-09 10:54:10 UTC (rev 293971)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2022-05-09 14:05:21 UTC (rev 293972)
@@ -827,6 +827,8 @@
if (shouldReconfigure)
unit.reconfigure();
+
+ m_currentSettings = std::nullopt;
}
CoreAudioCaptureSource::~CoreAudioCaptureSource()
@@ -865,7 +867,7 @@
if (!m_currentSettings) {
RealtimeMediaSourceSettings settings;
settings.setVolume(volume());
- settings.setSampleRate(unit().actualSampleRate());
+ settings.setSampleRate(unit().isRenderingAudio() ? unit().actualSampleRate() : sampleRate());
settings.setDeviceId(hashedId());
settings.setLabel(name());
settings.setEchoCancellation(echoCancellation());
@@ -884,6 +886,11 @@
void CoreAudioCaptureSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings)
{
+ if (!m_isReadyToStart) {
+ m_currentSettings = std::nullopt;
+ return;
+ }
+
bool shouldReconfigure = false;
if (settings.contains(RealtimeMediaSourceSettings::Flag::EchoCancellation)) {
unit().setEnableEchoCancellation(echoCancellation());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes