Skip to content

Commit 0dc5f2c

Browse files
committed
REGRESSION(284072@main): [GStreamer] A lot of media tests crash with Assertion "SHOULD NEVER BE REACHED"
https://bugs.webkit.org/show_bug.cgi?id=280334 Reviewed by Xabier Rodriguez-Calvar and Philippe Normand. A video can work in two modes: streaming mode (GstQueue2 element is used, GST_MESSAGE_BUFFERING is relied upon to get buffering info) or download mode (GstDownloadBuffer element is used, fillTimer is used to poll its buffering percentage). However, under some circumstances (file or mediastream URI, for instance), none of these two GStreamer elements are created and the player private was expecting the video to work in download mode. The failing assert higlighted the mismatch when fillTimerFired asked for the buffering percentage. But the truth is that in these special cases the video can actually work in stream mode and ask the whole pipeline or the sinks for the buffering percentage (which usually is just 100%, meaning that buffering is complete). This commit acknowledges the existence of these special cases and removes the assert. Also, it stops the fillTimer when buffering reaches 100% in those cases, to avoid wasting resources. * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::queryBufferingPercentage): Removed assert. Added extra comment. Stop fillTimer (and report it in the logs) when on stream mode and buffering reaching 100%. Canonical link: https://commits.webkit.org/284353@main
1 parent 56277c7 commit 0dc5f2c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,12 @@ std::optional<int> MediaPlayerPrivateGStreamer::queryBufferingPercentage()
13111311
elementName = "<undefined>"_s;
13121312
GST_TRACE_OBJECT(pipeline(), "[Buffering] %s reports %d buffering", elementName.characters(), percentage);
13131313

1314-
if (mode != GST_BUFFERING_DOWNLOAD) {
1315-
GST_WARNING_OBJECT(pipeline(), "[Buffering] mode isn't GST_BUFFERING_DOWNLOAD, but it should be!");
1316-
ASSERT_NOT_REACHED();
1314+
// Normally, the fillTimer only works with buffering download (GstDownloadBuffer present), but for some
1315+
// protocols, such as mediastream or file, that element isn't present and que query works in buffering
1316+
// stream mode. When buffering has reached 100%, we stop the fillTimer because it won't ever go down.
1317+
if (mode != GST_BUFFERING_DOWNLOAD && percentage >= 100.0) {
1318+
m_fillTimer.stop();
1319+
GST_DEBUG_OBJECT(pipeline(), "[Buffering] fillTimer not in GST_BUFFERING_DOWNLOAD mode and buffer level 100%%, disabling fillTimer.");
13171320
return percentage;
13181321
}
13191322

0 commit comments

Comments
 (0)