- Revision
- 293771
- Author
- commit-qu...@webkit.org
- Date
- 2022-05-04 03:43:28 -0700 (Wed, 04 May 2022)
Log Message
[GStreamer] Mediastream mock audio interruption fixes after r290985
https://bugs.webkit.org/show_bug.cgi?id=239926
Patch by Philippe Normand <pnorm...@igalia.com> on 2022-05-04
Reviewed by Chris Dumez.
Similarly to mock video sources, the GStreamer mock audio sources are now cached in a
hashset, which is used to dispatch interruption requests.
* platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
(WebCore::GStreamerAudioCaptureSource::interrupted const): Avoid runtime critical GObject
warnings that would happen if this method is called before the pipeline has been created.
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp: Cache mock sources in a hashset.
(WebCore::MockRealtimeAudioSourceGStreamer::~MockRealtimeAudioSourceGStreamer):
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h:
* platform/mock/MockRealtimeAudioSource.cpp: Dispatch interruption requests to currently
cached GStreamer mock audio sources.
(WebCore::MockRealtimeAudioSource::setIsInterrupted):
* platform/mock/MockRealtimeVideoSource.cpp: Switch to MainThreadNeverDestroyed<T> for caching sources.
(WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
(WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
LayoutTests:
* platform/glib/TestExpectations: Unflag mediastream tests now passing.
Canonical link: https://commits.webkit.org/250250@main
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (293770 => 293771)
--- trunk/LayoutTests/ChangeLog 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/LayoutTests/ChangeLog 2022-05-04 10:43:28 UTC (rev 293771)
@@ -1,3 +1,12 @@
+2022-04-30 Philippe Normand <ph...@igalia.com>
+
+ [GStreamer] Mediastream mock audio interruption fixes after r290985
+ https://bugs.webkit.org/show_bug.cgi?id=239926
+
+ Reviewed by Chris Dumez.
+
+ * platform/glib/TestExpectations: Unflag mediastream tests now passing.
+
2022-05-04 Philippe Normand <ph...@igalia.com>
Web Inspector: Update jsmin to 3.0.1
Modified: trunk/LayoutTests/platform/glib/TestExpectations (293770 => 293771)
--- trunk/LayoutTests/platform/glib/TestExpectations 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2022-05-04 10:43:28 UTC (rev 293771)
@@ -781,9 +781,6 @@
webkit.org/b/230415 fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html [ Timeout ]
webkit.org/b/79203 fast/mediastream/RTCRtpSender-replaceTrack.html [ Failure ]
webkit.org/b/187603 fast/mediastream/media-stream-track-source-failure.html [ Timeout Failure Pass ]
-fast/mediastream/media-stream-video-track-interrupted-from-audio.html [ Failure ]
-fast/mediastream/media-stream-track-interrupted.html [ Failure ]
-fast/mediastream/track-ended-while-muted.html [ Failure ]
webkit.org/b/223508 imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html [ Failure Pass ]
Modified: trunk/Source/WebCore/ChangeLog (293770 => 293771)
--- trunk/Source/WebCore/ChangeLog 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/Source/WebCore/ChangeLog 2022-05-04 10:43:28 UTC (rev 293771)
@@ -1,3 +1,26 @@
+2022-05-03 Philippe Normand <ph...@igalia.com>
+
+ [GStreamer] Mediastream mock audio interruption fixes after r290985
+ https://bugs.webkit.org/show_bug.cgi?id=239926
+
+ Reviewed by Chris Dumez.
+
+ Similarly to mock video sources, the GStreamer mock audio sources are now cached in a
+ hashset, which is used to dispatch interruption requests.
+
+ * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
+ (WebCore::GStreamerAudioCaptureSource::interrupted const): Avoid runtime critical GObject
+ warnings that would happen if this method is called before the pipeline has been created.
+ * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp: Cache mock sources in a hashset.
+ (WebCore::MockRealtimeAudioSourceGStreamer::~MockRealtimeAudioSourceGStreamer):
+ * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h:
+ * platform/mock/MockRealtimeAudioSource.cpp: Dispatch interruption requests to currently
+ cached GStreamer mock audio sources.
+ (WebCore::MockRealtimeAudioSource::setIsInterrupted):
+ * platform/mock/MockRealtimeVideoSource.cpp: Switch to MainThreadNeverDestroyed<T> for caching sources.
+ (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
+ (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
+
2022-05-04 Kimmo Kinnunen <kkinnu...@apple.com>
DisplayList::Recorder has redundant, unused flushContext
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp (293770 => 293771)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp 2022-05-04 10:43:28 UTC (rev 293771)
@@ -203,7 +203,10 @@
bool GStreamerAudioCaptureSource::interrupted() const
{
- return m_capturer->isInterrupted() || RealtimeMediaSource::interrupted();
+ if (m_capturer->pipeline())
+ return m_capturer->isInterrupted() || RealtimeMediaSource::interrupted();
+
+ return RealtimeMediaSource::interrupted();
}
void GStreamerAudioCaptureSource::setInterruptedForTesting(bool isInterrupted)
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp (293770 => 293771)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp 2022-05-04 10:43:28 UTC (rev 293771)
@@ -39,6 +39,17 @@
static const double s_NoiseFrequency = 3000;
static const double s_NoiseVolume = 0.05;
+static HashSet<MockRealtimeAudioSource*>& allMockRealtimeAudioSourcesStorage()
+{
+ static MainThreadNeverDestroyed<HashSet<MockRealtimeAudioSource*>> audioSources;
+ return audioSources;
+}
+
+const HashSet<MockRealtimeAudioSource*>& MockRealtimeAudioSourceGStreamer::allMockRealtimeAudioSources()
+{
+ return allMockRealtimeAudioSourcesStorage();
+}
+
CaptureSourceOrError MockRealtimeAudioSource::create(String&& deviceID, AtomString&& name, String&& hashSalt, const MediaConstraints* constraints, PageIdentifier)
{
#ifndef NDEBUG
@@ -66,8 +77,14 @@
: MockRealtimeAudioSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt), { })
{
ensureGStreamerInitialized();
+ allMockRealtimeAudioSourcesStorage().add(this);
}
+MockRealtimeAudioSourceGStreamer::~MockRealtimeAudioSourceGStreamer()
+{
+ allMockRealtimeAudioSourcesStorage().remove(this);
+}
+
void MockRealtimeAudioSourceGStreamer::render(Seconds delta)
{
if (!m_bipBopBuffer.size())
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h (293770 => 293771)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h 2022-05-04 10:43:28 UTC (rev 293771)
@@ -34,8 +34,10 @@
public:
static Ref<MockRealtimeAudioSource> createForMockAudioCapturer(String&& deviceID, AtomString&& name, String&& hashSalt);
- ~MockRealtimeAudioSourceGStreamer() = default;
+ static const HashSet<MockRealtimeAudioSource*>& allMockRealtimeAudioSources();
+ ~MockRealtimeAudioSourceGStreamer();
+
protected:
void render(Seconds) final;
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp (293770 => 293771)
--- trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp 2022-05-04 10:43:28 UTC (rev 293771)
@@ -46,6 +46,10 @@
#include "MockAudioSharedUnit.h"
#endif
+#if USE(GSTREAMER)
+#include "MockRealtimeAudioSourceGStreamer.h"
+#endif
+
namespace WebCore {
#if !PLATFORM(MAC) && !PLATFORM(IOS_FAMILY) && !USE(GSTREAMER)
@@ -188,6 +192,9 @@
MockAudioSharedUnit::singleton().suspend();
else
MockAudioSharedUnit::singleton().resume();
+#elif USE(GSTREAMER)
+ for (auto* source : MockRealtimeAudioSourceGStreamer::allMockRealtimeAudioSources())
+ source->setInterruptedForTesting(isInterrupted);
#endif
}
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (293770 => 293771)
--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2022-05-04 10:31:55 UTC (rev 293770)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2022-05-04 10:43:28 UTC (rev 293771)
@@ -69,7 +69,7 @@
static HashSet<MockRealtimeVideoSource*>& allMockRealtimeVideoSource()
{
- static NeverDestroyed<HashSet<MockRealtimeVideoSource*>> videoSources;
+ static MainThreadNeverDestroyed<HashSet<MockRealtimeVideoSource*>> videoSources;
return videoSources;
}
@@ -77,7 +77,6 @@
: RealtimeVideoCaptureSource(WTFMove(name), WTFMove(deviceID), WTFMove(hashSalt), pageIdentifier)
, m_emitFrameTimer(RunLoop::current(), this, &MockRealtimeVideoSource::generateFrame)
{
- ASSERT(isMainThread());
allMockRealtimeVideoSource().add(this);
auto device = MockRealtimeMediaSourceCenter::mockDeviceWithPersistentID(persistentID());
@@ -104,7 +103,6 @@
MockRealtimeVideoSource::~MockRealtimeVideoSource()
{
- ASSERT(isMainThread());
allMockRealtimeVideoSource().remove(this);
}