[GTK][WPE] Lots of media related tests crashing or flaky after r250918 - [ Mac WK2 ] Layout Test fast/mediastream/MediaStreamTrack-getSettings.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=202784
Unreviewed, fix GTK and WPE test crashes.
* platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
(WebCore::WrappedMockRealtimeAudioSource::render): Reconfigure if necessary.
(WebCore::WrappedMockRealtimeAudioSource::reconfigure): New, setup for rendering.
(WebCore::WrappedMockRealtimeAudioSource::settingsDidChange): Call reconfigure.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 3468950..ed3f98e 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2019-10-10 Eric Carlson <eric.carlson@apple.com>
+
+ [GTK][WPE] Lots of media related tests crashing or flaky after r250918 - [ Mac WK2 ] Layout Test fast/mediastream/MediaStreamTrack-getSettings.html is a flaky failure
+ https://bugs.webkit.org/show_bug.cgi?id=202784
+
+ Unreviewed, fix GTK and WPE test crashes.
+
+ * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
+ (WebCore::WrappedMockRealtimeAudioSource::render): Reconfigure if necessary.
+ (WebCore::WrappedMockRealtimeAudioSource::reconfigure): New, setup for rendering.
+ (WebCore::WrappedMockRealtimeAudioSource::settingsDidChange): Call reconfigure.
+
2019-10-10 youenn fablet <youenn@apple.com>
Remove unified plan runtime flag
diff --git a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp
index 42cb9c6..d8b929f 100644
--- a/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp
+++ b/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp
@@ -73,6 +73,9 @@
{
ASSERT(m_src);
+ if (!m_bipBopBuffer.size())
+ reconfigure();
+
uint32_t totalFrameCount = GST_ROUND_UP_16(static_cast<size_t>(delta.seconds() * sampleRate()));
uint32_t frameCount = std::min(totalFrameCount, m_maximiumFrameCount);
while (frameCount) {
@@ -98,30 +101,34 @@
}
}
+ void reconfigure()
+ {
+ GstAudioInfo info;
+ auto rate = sampleRate();
+ size_t sampleCount = 2 * rate;
+
+ m_maximiumFrameCount = WTF::roundUpToPowerOfTwo(renderInterval().seconds() * sampleRate());
+ gst_audio_info_set_format(&info, GST_AUDIO_FORMAT_F32LE, rate, 1, nullptr);
+ m_streamFormat = GStreamerAudioStreamDescription(info);
+
+ if (m_src)
+ gst_app_src_set_caps(GST_APP_SRC(m_src.get()), m_streamFormat->caps());
+
+ m_bipBopBuffer.resize(sampleCount);
+ m_bipBopBuffer.fill(0);
+
+ size_t bipBopSampleCount = ceil(s_BipBopDuration * rate);
+ size_t bipStart = 0;
+ size_t bopStart = rate;
+
+ addHum(s_BipBopVolume, s_BipFrequency, rate, 0, static_cast<float*>(m_bipBopBuffer.data() + bipStart), bipBopSampleCount);
+ addHum(s_BipBopVolume, s_BopFrequency, rate, 0, static_cast<float*>(m_bipBopBuffer.data() + bopStart), bipBopSampleCount);
+ }
+
void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings)
{
- if (settings.contains(RealtimeMediaSourceSettings::Flag::SampleRate)) {
- GstAudioInfo info;
- auto rate = sampleRate();
- size_t sampleCount = 2 * rate;
-
- m_maximiumFrameCount = WTF::roundUpToPowerOfTwo(renderInterval().seconds() * sampleRate());
- gst_audio_info_set_format(&info, GST_AUDIO_FORMAT_F32LE, rate, 1, nullptr);
- m_streamFormat = GStreamerAudioStreamDescription(info);
-
- if (m_src)
- gst_app_src_set_caps(GST_APP_SRC(m_src.get()), m_streamFormat->caps());
-
- m_bipBopBuffer.grow(sampleCount);
- m_bipBopBuffer.fill(0);
-
- size_t bipBopSampleCount = ceil(s_BipBopDuration * rate);
- size_t bipStart = 0;
- size_t bopStart = rate;
-
- addHum(s_BipBopVolume, s_BipFrequency, rate, 0, static_cast<float*>(m_bipBopBuffer.data() + bipStart), bipBopSampleCount);
- addHum(s_BipBopVolume, s_BopFrequency, rate, 0, static_cast<float*>(m_bipBopBuffer.data() + bopStart), bipBopSampleCount);
- }
+ if (settings.contains(RealtimeMediaSourceSettings::Flag::SampleRate))
+ reconfigure();
MockRealtimeAudioSource::settingsDidChange(settings);
}