Commit cf98ff8
committed
[MSE][GStreamer] Support markEndOfStream() before appendBuffer()
https://bugs.webkit.org/show_bug.cgi?id=278726
Reviewed by Xabier Rodriguez-Calvar.
MediaSource::markEndOfStream() causes the SourceBuffer TrackBuffers to push
EOS to playback pipeline through WebKitMediaSrc. When that happens without
any SourceBuffer::appendBuffer() call, the pipeline can't finish autoplugging
and parsebin triggers an unrecoverable error. That's on GStreamer 1.18.6 at
least. On GStreamer 1.24 no error is triggered, but still, playback (of no
data) never finishes.
While it's certainly possible to change parsebin to not trigger the error,
the truth is that this seems legitimate GStreamer behaviour that shouldn't be
altered (and also, doesn't fix the problem by itself, I've checked it,
playback doesn't finish, see previous paragraph).
This commit adds support for temporarily ignoring the error when using an
affected GStreamer version, and asking the pipeline to change to READY state.
It also notifies HTMLMediaElement about timeChanged, so the "ended" event can
be triggered (after all, there's no other position to go beyond 0, as there
are no samples and 0 is already the duration, so technically playback is ended).
See: #1366
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Allow time change processing when duration is zero and current time is zero.
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ignore errors when the m_ignoreErrors flag is enabled.
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add m_ignoreErrors flag.
* Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::updateStates): Report time changed on EOS with no buffer.
(WebCore::MediaPlayerPrivateGStreamerMSE::setEosWithNoBuffers): Set the m_isEosWithNoBuffer flag. Change the pipeline to READY when enabled (with errors disabled on older GStreamer versions).
* Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: Added m_isEosWithNoBuffer flag.
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::markEndOfStream): Detect the "EOS with no buffers" condition and report it to the player private.
(WebCore::MediaSourcePrivateGStreamer::unmarkEndOfStream): Disable the "EOS with no buffers" condition.
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h: Added unmarkEndOfStream().
Canonical link: https://commits.webkit.org/282958@main1 parent d325573 commit cf98ff8
6 files changed
Lines changed: 37 additions & 3 deletions
File tree
- Source/WebCore
- html
- platform/graphics/gstreamer
- mse
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5167 | 5167 | | |
5168 | 5168 | | |
5169 | 5169 | | |
5170 | | - | |
| 5170 | + | |
5171 | 5171 | | |
5172 | 5172 | | |
5173 | 5173 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1814 | 1814 | | |
1815 | 1815 | | |
1816 | 1816 | | |
1817 | | - | |
| 1817 | + | |
1818 | 1818 | | |
1819 | 1819 | | |
1820 | 1820 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
452 | 453 | | |
453 | 454 | | |
454 | 455 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
432 | 437 | | |
433 | 438 | | |
434 | 439 | | |
| |||
476 | 481 | | |
477 | 482 | | |
478 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
479 | 501 | | |
480 | 502 | | |
481 | 503 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| 117 | + | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
| 155 | + | |
148 | 156 | | |
149 | 157 | | |
150 | 158 | | |
| |||
0 commit comments