mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Replace AVError with FFmpegError (#129689)
This commit is contained in:
parent
f7103da818
commit
5bd63bb56b
@ -47,7 +47,7 @@ class StreamWorkerError(Exception):
|
|||||||
"""An exception thrown while processing a stream."""
|
"""An exception thrown while processing a stream."""
|
||||||
|
|
||||||
|
|
||||||
def redact_av_error_string(err: av.AVError) -> str:
|
def redact_av_error_string(err: av.FFmpegError) -> str:
|
||||||
"""Return an error string with credentials redacted from the url."""
|
"""Return an error string with credentials redacted from the url."""
|
||||||
parts = [str(err.type), err.strerror]
|
parts = [str(err.type), err.strerror]
|
||||||
if err.filename is not None:
|
if err.filename is not None:
|
||||||
@ -525,7 +525,7 @@ def stream_worker(
|
|||||||
del pyav_options["stimeout"]
|
del pyav_options["stimeout"]
|
||||||
try:
|
try:
|
||||||
container = av.open(source, options=pyav_options, timeout=SOURCE_TIMEOUT)
|
container = av.open(source, options=pyav_options, timeout=SOURCE_TIMEOUT)
|
||||||
except av.AVError as err:
|
except av.FFmpegError as err:
|
||||||
raise StreamWorkerError(
|
raise StreamWorkerError(
|
||||||
f"Error opening stream ({redact_av_error_string(err)})"
|
f"Error opening stream ({redact_av_error_string(err)})"
|
||||||
) from err
|
) from err
|
||||||
@ -599,7 +599,7 @@ def stream_worker(
|
|||||||
except StopIteration as ex:
|
except StopIteration as ex:
|
||||||
container.close()
|
container.close()
|
||||||
raise StreamEndedError("Stream ended; no additional packets") from ex
|
raise StreamEndedError("Stream ended; no additional packets") from ex
|
||||||
except av.AVError as ex:
|
except av.FFmpegError as ex:
|
||||||
container.close()
|
container.close()
|
||||||
raise StreamWorkerError(
|
raise StreamWorkerError(
|
||||||
f"Error demuxing stream while finding first packet ({redact_av_error_string(ex)})"
|
f"Error demuxing stream while finding first packet ({redact_av_error_string(ex)})"
|
||||||
@ -626,7 +626,7 @@ def stream_worker(
|
|||||||
raise
|
raise
|
||||||
except StopIteration as ex:
|
except StopIteration as ex:
|
||||||
raise StreamEndedError("Stream ended; no additional packets") from ex
|
raise StreamEndedError("Stream ended; no additional packets") from ex
|
||||||
except av.AVError as ex:
|
except av.FFmpegError as ex:
|
||||||
raise StreamWorkerError(
|
raise StreamWorkerError(
|
||||||
f"Error demuxing stream ({redact_av_error_string(ex)})"
|
f"Error demuxing stream ({redact_av_error_string(ex)})"
|
||||||
) from ex
|
) from ex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user