Skip to content

Commit d464d40

Browse files
authored
[Cherry-pick for 0.1.0] Raise error when num_ffmpeg_threads is None (#401) (#402)
1 parent cb0c6a2 commit d464d40

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/torchcodec/decoders/_video_decoder.py

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class VideoDecoder:
4747
Use 1 for single-threaded decoding which may be best if you are running multiple
4848
instances of ``VideoDecoder`` in parallel. Use a higher number for multi-threaded
4949
decoding which is best if you are running a single instance of ``VideoDecoder``.
50+
Passing 0 lets FFmpeg decide on the number of threads.
5051
Default: 1.
5152
device (str or torch.device, optional): The device to use for decoding. Default: "cpu".
5253
@@ -88,6 +89,9 @@ def __init__(
8889
f"Supported values are {', '.join(allowed_dimension_orders)}."
8990
)
9091

92+
if num_ffmpeg_threads is None:
93+
raise ValueError(f"{num_ffmpeg_threads = } should be an int.")
94+
9195
core.scan_all_streams_to_update_metadata(self._decoder)
9296
core.add_video_stream(
9397
self._decoder,

0 commit comments

Comments
 (0)