Modified: trunk/LayoutTests/ChangeLog (277650 => 277651)
--- trunk/LayoutTests/ChangeLog 2021-05-18 13:23:44 UTC (rev 277650)
+++ trunk/LayoutTests/ChangeLog 2021-05-18 13:46:24 UTC (rev 277651)
@@ -1,3 +1,15 @@
+2021-05-18 Philippe Normand <[email protected]>
+
+ [MediaStream][GStreamer] Flaky fast/mediastream/MediaStream-video-element-video-tracks-disabled.html
+ https://bugs.webkit.org/show_bug.cgi?id=225651
+
+ Reviewed by Alicia Boya Garcia.
+
+ * fast/mediastream/MediaStream-video-element-video-tracks-disabled.html: Delay the
+ notifyDone call to give the video element some time to render the black frame corresponding
+ to the disabled track. This might still flake on the bots, if that is the case we might need
+ to reassess how the test behaves or decide to mark it as expected flaky on glib ports.
+
2021-05-18 Alan Bujtas <[email protected]>
Difficult to scroll calcalist.co.il webpage, scrolling gets 'stuck'
Modified: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled.html (277650 => 277651)
--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled.html 2021-05-18 13:23:44 UTC (rev 277650)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-video-tracks-disabled.html 2021-05-18 13:46:24 UTC (rev 277651)
@@ -42,7 +42,7 @@
function canplaythrough()
{
mediaStream.getVideoTracks()[0].enabled = false;
- window.testRunner.notifyDone();
+ setTimeout(() => { window.testRunner.notifyDone(); }, 200);
}
function canplay()
Modified: trunk/Source/WebCore/ChangeLog (277650 => 277651)
--- trunk/Source/WebCore/ChangeLog 2021-05-18 13:23:44 UTC (rev 277650)
+++ trunk/Source/WebCore/ChangeLog 2021-05-18 13:46:24 UTC (rev 277651)
@@ -1,3 +1,17 @@
+2021-05-18 Philippe Normand <[email protected]>
+
+ [MediaStream][GStreamer] Flaky fast/mediastream/MediaStream-video-element-video-tracks-disabled.html
+ https://bugs.webkit.org/show_bug.cgi?id=225651
+
+ Reviewed by Alicia Boya Garcia.
+
+ Push the black frame as soon as the corresponding track has been disabled. The black frame
+ is also now created once only and reused, instead of re-creating it 30 times per second (or
+ whatever the frame rate is). The cached frame is updated when the track dimensions change as
+ well.
+
+ * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
+
2021-05-18 Alan Bujtas <[email protected]>
Difficult to scroll calcalist.co.il webpage, scrolling gets 'stuck'
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp (277650 => 277651)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp 2021-05-18 13:23:44 UTC (rev 277650)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp 2021-05-18 13:46:24 UTC (rev 277651)
@@ -240,11 +240,22 @@
void trackStarted(MediaStreamTrackPrivate&) final { };
void trackEnded(MediaStreamTrackPrivate&) final;
- void trackEnabledChanged(MediaStreamTrackPrivate&) final { };
void trackMutedChanged(MediaStreamTrackPrivate&) final { };
void trackSettingsChanged(MediaStreamTrackPrivate&) final { };
void readyStateChanged(MediaStreamTrackPrivate&) final { };
+ void trackEnabledChanged(MediaStreamTrackPrivate&) final
+ {
+ GST_INFO_OBJECT(m_src.get(), "Track enabled: %s", boolForPrinting(m_track.enabled()));
+ if (m_blackFrame && !m_track.enabled()) {
+ m_enoughData = false;
+ m_needsDiscont = true;
+ gst_element_send_event(m_src.get(), gst_event_new_flush_start());
+ gst_element_send_event(m_src.get(), gst_event_new_flush_stop(FALSE));
+ pushBlackFrame();
+ }
+ }
+
void videoSampleAvailable(MediaSample& sample) final
{
if (!m_parent)
@@ -251,13 +262,43 @@
return;
auto* gstSample = static_cast<MediaSampleGStreamer*>(&sample)->platformSample().sample.gstSample;
+ auto* caps = gst_sample_get_caps(gstSample);
+ GstVideoInfo info;
+ gst_video_info_from_caps(&info, caps);
+
+ int width = GST_VIDEO_INFO_WIDTH(&info);
+ int height = GST_VIDEO_INFO_HEIGHT(&info);
+ if (m_lastKnownSize != IntSize(width, height)) {
+ m_lastKnownSize.setWidth(width);
+ m_lastKnownSize.setHeight(height);
+ updateBlackFrame(caps);
+ }
+
if (m_track.enabled()) {
+ GST_TRACE_OBJECT(m_src.get(), "Pushing video frame from enabled track");
pushSample(gstSample);
return;
}
- // In case the track is disabled, emit a black I420 frame.
- auto caps = adoptGRef(gst_caps_copy(gst_sample_get_caps(gstSample)));
+ pushBlackFrame();
+ }
+
+ void audioSamplesAvailable(const MediaTime&, const PlatformAudioData& audioData, const AudioStreamDescription&, size_t) final
+ {
+ // TODO: We likely need to emit silent audio frames in case the track is disabled.
+ if (!m_track.enabled() || !m_parent)
+ return;
+
+ const auto& data = "" GStreamerAudioData&>(audioData);
+ auto sample = data.getSample();
+ pushSample(sample.get());
+ }
+
+private:
+ void updateBlackFrame(const GstCaps* sampleCaps)
+ {
+ GST_DEBUG_OBJECT(m_src.get(), "Updating black video frame");
+ auto caps = adoptGRef(gst_caps_copy(sampleCaps));
gst_caps_set_simple(caps.get(), "format", G_TYPE_STRING, "I420", nullptr);
GstVideoInfo info;
@@ -270,23 +311,16 @@
memset(data.data(), 0, yOffset);
memset(data.data() + yOffset, 128, data.size() - yOffset);
}
- gst_buffer_add_video_meta_full(buffer.get(), GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_I420, GST_VIDEO_INFO_WIDTH(&info), GST_VIDEO_INFO_HEIGHT(&info), 3, info.offset, info.stride);
- auto blackSample = adoptGRef(gst_sample_new(buffer.get(), caps.get(), nullptr, nullptr));
- pushSample(blackSample.get());
+ gst_buffer_add_video_meta_full(buffer.get(), GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_I420, m_lastKnownSize.width(), m_lastKnownSize.height(), 3, info.offset, info.stride);
+ m_blackFrame = adoptGRef(gst_sample_new(buffer.get(), caps.get(), nullptr, nullptr));
}
- void audioSamplesAvailable(const MediaTime&, const PlatformAudioData& audioData, const AudioStreamDescription&, size_t) final
+ void pushBlackFrame()
{
- // TODO: We likely need to emit silent audio frames in case the track is disabled.
- if (!m_track.enabled() || !m_parent)
- return;
-
- const auto& data = "" GStreamerAudioData&>(audioData);
- auto sample = data.getSample();
- pushSample(sample.get());
+ GST_TRACE_OBJECT(m_src.get(), "Pushing black video frame");
+ pushSample(m_blackFrame.get());
}
-private:
GstElement* m_parent { nullptr };
MediaStreamTrackPrivate& m_track;
GRefPtr<GstElement> m_src;
@@ -297,6 +331,8 @@
bool m_isObserving { false };
RefPtr<AudioTrackPrivateMediaStream> m_audioTrack;
RefPtr<VideoTrackPrivateMediaStream> m_videoTrack;
+ IntSize m_lastKnownSize;
+ GRefPtr<GstSample> m_blackFrame;
};
struct _WebKitMediaStreamSrcPrivate {