Skip to content

[GStreamer] Use Content-Range to get the resource size when Content-L… - #1737

Open
petartijanic01 wants to merge 1 commit into
WebPlatformForEmbedded:wpe-2.46from
petartijanic01:gstreamer-content-range-size
Open

petartijanic01 wants to merge 1 commit into
WebPlatformForEmbedded:wpe-2.46from
petartijanic01:gstreamer-content-range-size

Conversation

@petartijanic01

@petartijanic01 petartijanic01 commented Oct 22, 2026 •

Copy link
Copy Markdown

…ength is missing

A server can answer a progressive media request with 206 Partial Content and
Content-Range but without Content-Length (e.g. chunked transfer encoding). The
total size is then only available in Content-Range ("bytes 0-25059330/25059331").

WebKitWebSource took the size only from Content-Length, so the resource was
reported as unseekable with no size, and MediaPlayerPrivateGStreamer set
m_isLiveStream. seekable() was empty and every seek was ignored
("ignored seek to ...").

This change takes the total size from a valid Content-Range when Content-Length
is missing, in both places. Responses with Content-Length and live streams
without Content-Range are not affected.

Fixes HbbTV test org.hbbtv_HTML52090 (seek to an unbuffered position in a
progressive MP4 must issue a Range request).

Testing: a server answering 206 + Content-Range, chunked, without
Content-Length. Before: the seek is ignored and no new request is made.
After: the seek issues "Range: bytes=14404095-" and playback continues from
the seek position.

a02cf70

Build-Tests Layout-Tests
✅ 🛠 wpe-246-amd64-build ✅ 🧪 wpe-246-amd64-layout
✅ 🛠 wpe-246-arm32-build ✅ 🧪 wpe-246-arm32-layout

…ength is missing

A server can answer a progressive media request with 206 Partial Content
and a Content-Range header but without Content-Length, for example when
the body is sent with chunked transfer encoding. The total size is then
only available as the instance length in Content-Range, for example
"bytes 0-25059330/25059331".

WebKitWebSource took the size only from Content-Length, so such a
resource was reported as having no size and not being seekable.
MediaPlayerPrivateGStreamer found no Content-Length in the response
headers either and set m_isLiveStream. maxTimeSeekable() then returned
zero, seekable() was empty and HTMLMediaElement ignored every seek.

When Content-Length is missing, take the total size from a valid
Content-Range in both places.

This fixes the HbbTV test org.hbbtv_HTML52090, where a seek to an
unbuffered position in a progressive MP4 must issue a Range request.

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::responseReceived):
@eocanha
eocanha self-requested a review October 23, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants