Diff
Modified: trunk/LayoutTests/ChangeLog (275826 => 275827)
--- trunk/LayoutTests/ChangeLog 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/LayoutTests/ChangeLog 2021-04-12 17:18:28 UTC (rev 275827)
@@ -1,3 +1,12 @@
+2021-04-12 Philippe Normand <[email protected]>
+
+ [GStreamer][WebRTC] An audio track should be muted when capture is interrupted by the OS.
+ https://bugs.webkit.org/show_bug.cgi?id=196606
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ * platform/glib/TestExpectations: fast/mediastream/media-stream-track-interrupted.html is now passing.
+
2021-04-12 Sam Weinig <[email protected]>
Update color-contrast() to support a target contrast ratio
Modified: trunk/LayoutTests/platform/glib/TestExpectations (275826 => 275827)
--- trunk/LayoutTests/platform/glib/TestExpectations 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2021-04-12 17:18:28 UTC (rev 275827)
@@ -532,7 +532,6 @@
webkit.org/b/210385 fast/mediastream/stream-switch.html [ Crash Timeout ]
webkit.org/b/210528 fast/mediastream/MediaStream-MediaElement-setObject-null.html [ Crash Pass ]
webkit.org/b/210528 fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html [ Crash Pass ]
-webkit.org/b/213011 fast/mediastream/media-stream-track-interrupted.html [ Failure ]
webkit.org/b/203078 media/media-source/media-source-remove-unload-crash.html [ Crash Timeout Pass ]
webkit.org/b/210528 media/media-source/media-source-seek-back.html [ Crash Pass ]
Modified: trunk/Source/WebCore/ChangeLog (275826 => 275827)
--- trunk/Source/WebCore/ChangeLog 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/ChangeLog 2021-04-12 17:18:28 UTC (rev 275827)
@@ -1,3 +1,25 @@
+2021-04-12 Philippe Normand <[email protected]>
+
+ [GStreamer][WebRTC] An audio track should be muted when capture is interrupted by the OS.
+ https://bugs.webkit.org/show_bug.cgi?id=196606
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Add basic interruption support in the audio capture source and mock audio capture source.
+
+ * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
+ (WebCore::GStreamerAudioCaptureSource::interrupted const):
+ (WebCore::GStreamerAudioCaptureSource::setInterruptedForTesting):
+ * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
+ * platform/mediastream/gstreamer/GStreamerCapturer.cpp:
+ (WebCore::GStreamerCapturer::setupPipeline):
+ (WebCore::GStreamerCapturer::interrupted const):
+ (WebCore::GStreamerCapturer::setInterrupted):
+ * platform/mediastream/gstreamer/GStreamerCapturer.h:
+ * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp:
+ (WebCore::MockRealtimeAudioSourceGStreamer::setInterruptedForTesting):
+ * platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h:
+
2021-04-12 Sam Weinig <[email protected]>
Update color-contrast() to support a target contrast ratio
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp (275826 => 275827)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp 2021-04-12 17:18:28 UTC (rev 275827)
@@ -208,6 +208,17 @@
return m_currentSettings.value();
}
+bool GStreamerAudioCaptureSource::interrupted() const
+{
+ return m_capturer->isInterrupted() || RealtimeMediaSource::interrupted();
+}
+
+void GStreamerAudioCaptureSource::setInterruptedForTesting(bool isInterrupted)
+{
+ m_capturer->setInterrupted(isInterrupted);
+ RealtimeMediaSource::setInterruptedForTesting(isInterrupted);
+}
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h (275826 => 275827)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h 2021-04-12 17:18:28 UTC (rev 275827)
@@ -53,6 +53,9 @@
mutable Optional<RealtimeMediaSourceSettings> m_currentSettings;
private:
+ bool interrupted() const final;
+ void setInterruptedForTesting(bool) final;
+
bool isCaptureSource() const final { return true; }
void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) final;
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp (275826 => 275827)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp 2021-04-12 17:18:28 UTC (rev 275827)
@@ -108,6 +108,7 @@
GRefPtr<GstElement> source = createSource();
GRefPtr<GstElement> converter = createConverter();
+ m_valve = makeElement("valve");
m_capsfilter = makeElement("capsfilter");
m_tee = makeElement("tee");
m_sink = makeElement("appsink");
@@ -115,8 +116,8 @@
gst_app_sink_set_emit_signals(GST_APP_SINK(m_sink.get()), TRUE);
g_object_set(m_capsfilter.get(), "caps", m_caps.get(), nullptr);
- gst_bin_add_many(GST_BIN(m_pipeline.get()), source.get(), converter.get(), m_capsfilter.get(), m_tee.get(), nullptr);
- gst_element_link_many(source.get(), converter.get(), m_capsfilter.get(), m_tee.get(), nullptr);
+ gst_bin_add_many(GST_BIN(m_pipeline.get()), source.get(), converter.get(), m_capsfilter.get(), m_valve.get(), m_tee.get(), nullptr);
+ gst_element_link_many(source.get(), converter.get(), m_capsfilter.get(), m_valve.get(), m_tee.get(), nullptr);
addSink(m_sink.get());
@@ -182,6 +183,18 @@
gst_element_set_state(pipeline(), GST_STATE_NULL);
}
+bool GStreamerCapturer::isInterrupted() const
+{
+ gboolean isInterrupted;
+ g_object_get(m_valve.get(), "drop", &isInterrupted, nullptr);
+ return isInterrupted;
+}
+
+void GStreamerCapturer::setInterrupted(bool isInterrupted)
+{
+ g_object_set(m_valve.get(), "drop", isInterrupted, nullptr);
+}
+
} // namespace WebCore
#endif // ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.h (275826 => 275827)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.h 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.h 2021-04-12 17:18:28 UTC (rev 275827)
@@ -39,8 +39,8 @@
~GStreamerCapturer();
void setupPipeline();
- virtual void play();
- virtual void stop();
+ void play();
+ void stop();
GstCaps* caps();
void addSink(GstElement *newSink);
GstElement* makeElement(const char* factoryName);
@@ -54,9 +54,13 @@
GstElement* pipeline() const { return m_pipeline.get(); }
virtual GstElement* createConverter() = 0;
+ bool isInterrupted() const;
+ void setInterrupted(bool);
+
protected:
GRefPtr<GstElement> m_sink;
GRefPtr<GstElement> m_src;
+ GRefPtr<GstElement> m_valve;
GRefPtr<GstElement> m_tee;
GRefPtr<GstElement> m_capsfilter;
GRefPtr<GstDevice> m_device;
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp (275826 => 275827)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp 2021-04-12 17:18:28 UTC (rev 275827)
@@ -140,6 +140,12 @@
addHum(s_NoiseVolume, s_NoiseFrequency, rate, 0, m_bipBopBuffer.data(), sampleCount);
}
+void MockRealtimeAudioSourceGStreamer::setInterruptedForTesting(bool isInterrupted)
+{
+ m_isInterrupted = isInterrupted;
+ MockRealtimeAudioSource::setInterruptedForTesting(isInterrupted);
+}
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h (275826 => 275827)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h 2021-04-12 16:53:16 UTC (rev 275826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h 2021-04-12 17:18:28 UTC (rev 275827)
@@ -45,11 +45,15 @@
void reconfigure();
void addHum(float amplitude, float frequency, float sampleRate, uint64_t start, float *p, uint64_t count);
+ bool interrupted() const final { return m_isInterrupted; };
+ void setInterruptedForTesting(bool) final;
+
Optional<GStreamerAudioStreamDescription> m_streamFormat;
Vector<float> m_bipBopBuffer;
uint32_t m_maximiumFrameCount;
uint64_t m_samplesEmitted { 0 };
uint64_t m_samplesRendered { 0 };
+ bool m_isInterrupted { false };
};
} // namespace WebCore