Skip to content

Commit 7253ad2

Browse files
committed
Fix some stuff?
1 parent ec91729 commit 7253ad2

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

test/decoders/test_video_decoder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
assert_frames_equal,
1616
AV1_VIDEO,
1717
cpu_and_cuda,
18+
get_ffmpeg_major_version,
1819
H265_VIDEO,
19-
in_fbcode,
2020
NASA_VIDEO,
2121
)
2222

@@ -249,7 +249,7 @@ def test_getitem_slice(self, device, seek_mode):
249249
]
250250
)
251251
for sliced, ref in zip(all_frames, decoder):
252-
if not (in_fbcode() and device == "cuda"):
252+
if not (device == "cuda" and get_ffmpeg_major_version() == 4):
253253
# TODO: remove the "if".
254254
# See https://github.com/pytorch/torchcodec/issues/428
255255
assert_frames_equal(sliced, ref)
@@ -428,7 +428,7 @@ def test_get_frames_at_fails(self, device, seek_mode):
428428

429429
@pytest.mark.parametrize("device", cpu_and_cuda())
430430
def test_get_frame_at_av1(self, device):
431-
if in_fbcode() and device == "cuda":
431+
if device == "cuda" and get_ffmpeg_major_version() == 4:
432432
return
433433

434434
decoder = VideoDecoder(AV1_VIDEO.path, device=device)

test/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def cpu_and_cuda():
2525
return ("cpu", pytest.param("cuda", marks=pytest.mark.needs_cuda))
2626

2727

28+
def get_ffmpeg_major_version():
29+
return int(get_ffmpeg_library_versions()["ffmpeg_version"].split(".")[0])
30+
31+
2832
# For use with decoded data frames. On CPU Linux, we expect exact, bit-for-bit
2933
# equality. On CUDA Linux, we expect a small tolerance.
3034
# On other platforms (e.g. MacOS), we also allow a small tolerance. FFmpeg does
@@ -33,11 +37,8 @@ def cpu_and_cuda():
3337
def assert_frames_equal(*args, **kwargs):
3438
if sys.platform == "linux":
3539
if args[0].device.type == "cuda":
36-
ffmpeg_major_version = int(
37-
get_ffmpeg_library_versions()["ffmpeg_version"].split(".")[0]
38-
)
3940
atol = 2
40-
if in_fbcode() or ffmpeg_major_version == 4:
41+
if get_ffmpeg_major_version() == 4:
4142
assert_tensor_close_on_at_least(
4243
args[0], args[1], percentage=95, atol=atol
4344
)

0 commit comments

Comments
 (0)