Repository navigation
Conversation
The legacy adaptive demuxer library divides a fragment's size by the time from starting its download to its end, so the request round trip and the wait for the first byte count as transfer time. With 2 s live DASH segments and a few hundred milliseconds to the first byte, the small fragments of calm scenes read as a slow link, and dashdemux switches tagesschau24 from 720p down to 540p or 360p on a link with more than ten times the bandwidth 720p needs. Add a patch timing the transfer from the first buffer to the end of the fragment, so that the estimate follows the link. It adds a field to the library's stream struct; the demuxers using it are built from the same source. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Contributor
|
Is the patch upstream? |
GStreamer GL uploads a plane with GL_UNPACK_ROW_LENGTH set to its stride but leaves GL_UNPACK_ALIGNMENT at 4, so GL reads a plane whose stride is not a multiple of 4 with a rounded-up stride and past its end. The Widevine CDM puts out tightly packed I420, and WebKit draws YouTube's 240p and 480p, with 213 and 427 byte chroma rows, as green garbage. Add a patch setting the unpack alignment from the stride. Patch 202 is refreshed for the new context. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📦 Package Details
Maintainer: @flyn-org @thess
Description:
Two GStreamer fixes, one commit per package.
gst1-plugins-bad, patch 102: the legacy adaptive demuxer library (
libgstadaptivedemux, used bydashdemux,hlsdemuxandmssdemux) estimates the link bandwidth per fragment as its size divided by the time from starting the download to its end. That time includes the request round trip and the wait for the first byte. With live DASH in 2 s segments and a few hundred milliseconds to the first byte, which is common at the live edge of a CDN, the estimate follows the fragment size instead of the link: the small fragments of calm scenes read as a slow link, and since the demuxer takes the minimum of the last fragment and the average of the last three, times 0.8, a single small fragment is enough to switch down. tagesschau24 (dashdemuxin WPE WebKit) dropped from 720p (3.2 Mbit/s) to 540p or 360p every few seconds to minutes on a Wi-Fi link delivering 55 to 80 Mbit/s.Patch 102 times the transfer from the first buffer to the end of the fragment and uses that bitrate, or the whole-request bitrate where it is higher. A fragment that arrives in a single buffer has no measurable transfer; for it, the previous estimate is kept and only raised to the whole-request bitrate, since that is a lower bound of the link bandwidth. The patch adds one field to
GstAdaptiveDemuxStream, which the demuxers built from the same source pick up.gst1-plugins-base, patch 101: GStreamer GL uploads a texture plane with
GL_UNPACK_ROW_LENGTHset to the plane stride but leavesGL_UNPACK_ALIGNMENTat its default of 4 on desktop GL and GLES 3 (gst_gl_memory_texsubimage()). GL starts every source row at a multiple of the unpack alignment, so a plane whose stride is not a multiple of 4 is read with a rounded-up stride and past its end. Decoders usually pad their strides, but the Widevine CDM puts out tightly packed I420: WPE WebKit drew YouTube's 240p (426x240, 213 byte chroma rows) and 480p (854x480, 427 byte chroma rows) as green garbage, while 144p and 360p were fine. Patch 101 sets the unpack alignment to the largest power of two up to 8 that divides the stride, as the GLES 2 path already does with its alignment, and resets it afterwards. Patch 202 is refreshed for the new context.Each package's
PKG_RELEASEis bumped once. Neither patch is submitted upstream yet.LLM use: the cause analyses, both patches, their tests, the packaging, the commit messages and this description were written with LLM coding agents working under my direction, which also ran the tests below on my device.
🔬 Run Testing Details
<video>with playbin anddashdemux), video resolution sampled once a second from the DRM plane state:curlon the device, 720p segments download at 55 to 80 Mbit/s. A trace of WebKit's network process showed 128 to 717 kB per 2 s 720p segment and 80 to 440 ms to the first byte.dashdemuxtest with a test clock (400 ms to the first byte, 50 Mbit/s, 1.6 and 3.2 Mbit/s representations) passes 1 of 3 cases unpatched and 3 of 3 patched. Thehls_demux(13) andmssdemux(12) check programs pass with and without the patch.GST_GL_PLATFORM=egl GST_GL_WINDOW=surfaceless), a tightly packed 854x480 I420 frame repeated 20 times throughrawvideoparse ! glupload ! glcolorconvert ! video/x-raw(memory:GLMemory),format=RGBA ! gldownload:✅ Formalities
messages, and the description says what it was used for.
If your PR contains a patch:
git am