forked from kenzuya/unshackle
fix(drm): keep the track file when shaka-packager skips a stream with no samples
This commit is contained in:
@@ -270,6 +270,7 @@ def shaka_run(tmp_path: Path, make: Callable[[], Any], raises: type[BaseExceptio
|
||||
drm.content_keys[A] = KEY
|
||||
with pytest.raises(raises):
|
||||
drm.decrypt_with_shaka_packager(path)
|
||||
assert path.read_bytes() == b"encrypted"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("make", DRMS)
|
||||
@@ -299,6 +300,26 @@ def test_a_shaka_failure_logs_under_the_drm_label(
|
||||
assert len(fake_packager) == 1 and f"[{label}]: " in fake_packager[0] and "Bad key" in fake_packager[0]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("make", DRMS)
|
||||
def test_a_skipped_shaka_stream_keeps_the_input(
|
||||
tmp_path: Path, fake_packager: list[str], make: Callable[[], Any]
|
||||
) -> None:
|
||||
FakePackager.log = (
|
||||
"[1128/120000:INFO:mp4_muxer.cc(1)] Skip stream 'track_decrypted.mp4' which does not contain any sample.\n"
|
||||
)
|
||||
path = tmp_path / "track.mp4"
|
||||
path.write_bytes(b"encrypted")
|
||||
stray = tmp_path / "track_decrypted.mp4"
|
||||
stray.write_bytes(b"stale")
|
||||
drm = make()
|
||||
drm.content_keys[A] = KEY
|
||||
|
||||
drm.decrypt_with_shaka_packager(path)
|
||||
|
||||
assert path.read_bytes() == b"encrypted"
|
||||
assert not stray.exists()
|
||||
|
||||
|
||||
def test_a_shaka_ctrl_c_exit_is_a_keyboard_interrupt(tmp_path: Path, fake_packager: list[str]) -> None:
|
||||
FakePackager.code = 0xC000013A
|
||||
shaka_run(tmp_path, lambda: _widevine(A), KeyboardInterrupt)
|
||||
|
||||
Reference in New Issue
Block a user