feat(hls): carry a held media playlist over --remote and export, inflate gzip segments, add own_stream_only mux opt-in

This commit is contained in:
imSp4rky
2026-12-02 11:12:02 -07:00
parent ccdd14c845
commit 9842a61d3f
27 changed files with 404 additions and 62 deletions
+26
View File
@@ -0,0 +1,26 @@
"""A segment whose body is gzip with no Content-Encoding header is inflated before the merge; no other body is."""
from __future__ import annotations
import gzip
import pytest
from tests.core.test_rolling_merge_hls_ism import INIT, PARTS, hls_track, make_ctx, no_cancel, server # noqa: F401
from unshackle.core.manifests import HLS
@pytest.mark.parametrize(
"body, expected",
[
pytest.param(gzip.compress, lambda part: part, id="gzip"),
pytest.param(lambda part: b"\x1f\x8b\x08" + part, lambda part: b"\x1f\x8b\x08" + part, id="gzip-magic-only"),
pytest.param(lambda part: gzip.compress(part)[:-4], lambda part: gzip.compress(part)[:-4], id="cut-gzip"),
],
)
def test_only_a_whole_gzip_segment_is_inflated(body, expected, server, tmp_path): # noqa: F811
for i, part in enumerate(PARTS):
server.routes[f"/part{i}.m4s"] = body(part)
ctx = make_ctx(tmp_path, "out.mp4")
HLS.download_track(hls_track(server, False), ctx)
assert ctx.save_path.read_bytes() == INIT + b"".join(map(expected, PARTS))