Skip to content

Commit

Permalink
Raise CalledProcessError if Shaka logs an error
Browse files Browse the repository at this point in the history
This seems to be necessary as Shaka-packager seems to always return exit code 0, even on errors.
  • Loading branch information
rlaphoenix committed Jul 15, 2023
1 parent f3cfaa3 commit aff40df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion devine/core/drm/widevine.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def decrypt(self, path: Path) -> None:
)

stream_skipped = False
had_error = False

shaka_log_buffer = ""
for line in iter(p.stderr.readline, ""):
Expand All @@ -270,6 +271,8 @@ def decrypt(self, path: Path) -> None:
stream_skipped = True
if ":INFO:" in line:
continue
if ":ERROR:" in line:
had_error = True
if "Insufficient bits in bitstream for given AVC profile" in line:
# this is a warning and is something we don't have to worry about
continue
Expand All @@ -286,7 +289,7 @@ def decrypt(self, path: Path) -> None:

p.wait()

if p.returncode != 0:
if p.returncode != 0 or had_error:
raise subprocess.CalledProcessError(p.returncode, arguments)

path.unlink()
Expand Down

0 comments on commit aff40df

Please sign in to comment.