Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c2be52a6dcc59817b09efba278ded3e1db50a1fa
https://github.com/WebKit/WebKit/commit/c2be52a6dcc59817b09efba278ded3e1db50a1fa
Author: Vivienne Watermeier <[email protected]>
Date: 2026-02-05 (Thu, 05 Feb 2026)
Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/media/media-source/media-source-changetype-tracks-expected.txt
A LayoutTests/media/media-source/media-source-changetype-tracks.html
M LayoutTests/platform/glib/TestExpectations
M Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderParser.cpp
M Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
M Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h
M
Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp
M
Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h
Log Message:
-----------
[MSE][GStreamer] Experimental changeType() support
https://bugs.webkit.org/show_bug.cgi?id=306281
Reviewed by Alicia Boya Garcia.
Add support for changeType(), by replacing most elements in the append
pipeline. Construction of the new elements works similar to the initial
construction of the pipeline:
First we create appsrc, typefind and demuxer elements, and once the
demuxer has exposed all the pads, we create optional parser and
encoder elements for each stream, reusing only each appsrc.
In the playback pipeline, we only need to reset the
decryptor and inner-parser elements.
Since we require the new type to set up the demuxer, this does not support
implicit type changes (i.e. just appending an init segment without a
changeType()).
A few of the tests in
imported/w3c/web-platform-tests/media-source/mediasource-changetype-play.html
are still affected by two bugs:
1. when a range of samples is replaced, SourceBuffer may fail to remove some
individual samples,
which will likely break the decoder.
Might be related to https://bugs.webkit.org/show_bug.cgi?id=259397.
2. Deadlock during a flush: https://bugs.webkit.org/show_bug.cgi?id=272975
Test: media/media-source/media-source-changetype-tracks.html
Tests changetype with multiple tracks, since wpt tests are all single-track.
* LayoutTests/TestExpectations: Skip new test by default.
* LayoutTests/media/media-source/media-source-changetype-tracks-expected.txt:
Added.
* LayoutTests/media/media-source/media-source-changetype-tracks.html: Added.
* LayoutTests/platform/glib/TestExpectations: Mark all wpt changetype tests
except changetype-play-implicit.html as passing.
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderParser.cpp:
(webkitMediaThunderParserSinkPadProbe): Added. Probe to reset decryptor and
inner-parser for any new and incompatible pads.
(webkitMediaThunderParserConstructed): Set sink pad probe.
pad-added handler reuses the same ghost pad rather than creating a new one -
otherwise, the outer parsebin won't be able to link pads after a change in
caps,
and we never handle more than one stream here anyways.
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::setupDemuxing): Added. Moved setup for appsrc,
typefind, demuxer elements into their own method, so it can be re-used in type
changes.
(WebCore::AppendPipeline::AppendPipeline): Use setupDemuxing().
(WebCore::AppendPipeline::appsinkCapsChanged): Allow changed caps during a type
change. Unset ongoingChangeType.
(WebCore::AppendPipeline::didReceiveInitializationSegment): Unset
m_pendingInitializationSegmentForChangeType.
Give the pipeline dump a different name if the init segment is for a
changeType().
(WebCore::AppendPipeline::resetParserState): Call resetElementsForChangeType()
if needed.
(WebCore::AppendPipeline::startChangingType): Added. Set
m_pendingInitializationSegmentForChangeType, to start changes after next parser
reset.
(WebCore::AppendPipeline::resetElementsForChangeType): Replace appsrc,
typefind, demuxer elements for the new type, set ongoingChangeType on all
Tracks.
(WebCore::AppendPipeline::recycleTrackForPad): Always replace parser/encoder
elements during type change.
(WebCore::AppendPipeline::linkPadWithTrack): Add pipepline name to dumps for
easier debugging.
(WebCore::AppendPipeline::Track::emplaceOptionalElementsForFormat): Always
replace parser/encoder elements during type change.
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h: Added
m_pendingInitializationSegmentForTypeChange and track.ongoingChangeType flags.
*
Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::canSwitchToType): Added. Allow any type
we otherwise support, update m_type if supported.
(WebCore::SourceBufferPrivateGStreamer::startChangingType): Added. Inform
AppendPipeline about upcoming type change.
(WebCore::SourceBufferPrivateGStreamer::processInitializationSegment): Unset
m_pendingInitializationSegmentForChangeType.
Canonical link: https://commits.webkit.org/306852@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications