Skip to content

Commit 737e1b6

Browse files
committed
Remove explicit setting of seek_mode in unrelated tests
1 parent abad57b commit 737e1b6

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test/decoders/test_video_decoder_ops.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def seek(self, pts: float):
6565
class TestOps:
6666
@pytest.mark.parametrize("device", cpu_and_cuda())
6767
def test_seek_and_next(self, device):
68-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="approximate")
68+
decoder = create_from_file(str(NASA_VIDEO.path))
6969
add_video_stream(decoder, device=device)
7070
frame0, _, _ = get_next_frame(decoder)
7171
reference_frame0 = NASA_VIDEO.get_frame_data_by_index(0)
@@ -82,7 +82,7 @@ def test_seek_and_next(self, device):
8282

8383
@pytest.mark.parametrize("device", cpu_and_cuda())
8484
def test_seek_to_negative_pts(self, device):
85-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
85+
decoder = create_from_file(str(NASA_VIDEO.path))
8686
add_video_stream(decoder, device=device)
8787
frame0, _, _ = get_next_frame(decoder)
8888
reference_frame0 = NASA_VIDEO.get_frame_data_by_index(0)
@@ -94,7 +94,7 @@ def test_seek_to_negative_pts(self, device):
9494

9595
@pytest.mark.parametrize("device", cpu_and_cuda())
9696
def test_get_frame_at_pts(self, device):
97-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="approximate")
97+
decoder = create_from_file(str(NASA_VIDEO.path))
9898
add_video_stream(decoder, device=device)
9999
# This frame has pts=6.006 and duration=0.033367, so it should be visible
100100
# at timestamps in the range [6.006, 6.039367) (not including the last timestamp).
@@ -118,7 +118,7 @@ def test_get_frame_at_pts(self, device):
118118

119119
@pytest.mark.parametrize("device", cpu_and_cuda())
120120
def test_get_frame_at_index(self, device):
121-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
121+
decoder = create_from_file(str(NASA_VIDEO.path))
122122
add_video_stream(decoder, device=device)
123123
frame0, _, _ = get_frame_at_index(decoder, stream_index=3, frame_index=0)
124124
reference_frame0 = NASA_VIDEO.get_frame_data_by_index(0)
@@ -132,7 +132,7 @@ def test_get_frame_at_index(self, device):
132132

133133
@pytest.mark.parametrize("device", cpu_and_cuda())
134134
def test_get_frame_with_info_at_index(self, device):
135-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
135+
decoder = create_from_file(str(NASA_VIDEO.path))
136136
add_video_stream(decoder, device=device)
137137
frame6, pts, duration = get_frame_at_index(
138138
decoder, stream_index=3, frame_index=180
@@ -146,7 +146,7 @@ def test_get_frame_with_info_at_index(self, device):
146146

147147
@pytest.mark.parametrize("device", cpu_and_cuda())
148148
def test_get_frames_at_indices(self, device):
149-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
149+
decoder = create_from_file(str(NASA_VIDEO.path))
150150
add_video_stream(decoder, device=device)
151151
frames0and180, *_ = get_frames_at_indices(
152152
decoder, stream_index=3, frame_indices=[0, 180]
@@ -160,7 +160,7 @@ def test_get_frames_at_indices(self, device):
160160

161161
@pytest.mark.parametrize("device", cpu_and_cuda())
162162
def test_get_frames_at_indices_unsorted_indices(self, device):
163-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
163+
decoder = create_from_file(str(NASA_VIDEO.path))
164164
_add_video_stream(decoder, device=device)
165165
stream_index = 3
166166

@@ -191,7 +191,7 @@ def test_get_frames_at_indices_unsorted_indices(self, device):
191191

192192
@pytest.mark.parametrize("device", cpu_and_cuda())
193193
def test_get_frames_by_pts(self, device):
194-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
194+
decoder = create_from_file(str(NASA_VIDEO.path))
195195
_add_video_stream(decoder, device=device)
196196
stream_index = 3
197197

@@ -225,7 +225,7 @@ def test_pts_apis_against_index_ref(self, device):
225225
# Get all frames in the video, then query all frames with all time-based
226226
# APIs exactly where those frames are supposed to start. We assert that
227227
# we get the expected frame.
228-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
228+
decoder = create_from_file(str(NASA_VIDEO.path))
229229
add_video_stream(decoder, device=device)
230230

231231
metadata = get_json_metadata(decoder)
@@ -281,7 +281,7 @@ def test_pts_apis_against_index_ref(self, device):
281281

282282
@pytest.mark.parametrize("device", cpu_and_cuda())
283283
def test_get_frames_in_range(self, device):
284-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
284+
decoder = create_from_file(str(NASA_VIDEO.path))
285285
add_video_stream(decoder, device=device)
286286

287287
# ensure that the degenerate case of a range of size 1 works
@@ -331,7 +331,7 @@ def test_get_frames_in_range(self, device):
331331

332332
@pytest.mark.parametrize("device", cpu_and_cuda())
333333
def test_throws_exception_at_eof(self, device):
334-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="approximate")
334+
decoder = create_from_file(str(NASA_VIDEO.path))
335335
add_video_stream(decoder, device=device)
336336
seek_to_pts(decoder, 12.979633)
337337
last_frame, _, _ = get_next_frame(decoder)
@@ -342,7 +342,7 @@ def test_throws_exception_at_eof(self, device):
342342

343343
@pytest.mark.parametrize("device", cpu_and_cuda())
344344
def test_throws_exception_if_seek_too_far(self, device):
345-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="approximate")
345+
decoder = create_from_file(str(NASA_VIDEO.path))
346346
add_video_stream(decoder, device=device)
347347
# pts=12.979633 is the last frame in the video.
348348
seek_to_pts(decoder, 12.979633 + 1.0e-4)
@@ -364,7 +364,7 @@ def get_frame1_and_frame_time6(decoder):
364364

365365
# NB: create needs to happen outside the torch.compile region,
366366
# for now. Otherwise torch.compile constant-props it.
367-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="approximate")
367+
decoder = create_from_file(str(NASA_VIDEO.path))
368368
frame0, frame_time6 = get_frame1_and_frame_time6(decoder)
369369
reference_frame0 = NASA_VIDEO.get_frame_data_by_index(0)
370370
reference_frame_time6 = NASA_VIDEO.get_frame_data_by_index(
@@ -442,7 +442,7 @@ def test_video_get_json_metadata(self):
442442
assert metadata_dict["bitRate"] == 324915.0
443443

444444
def test_video_get_json_metadata_with_stream(self):
445-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
445+
decoder = create_from_file(str(NASA_VIDEO.path))
446446
add_video_stream(decoder)
447447
metadata = get_json_metadata(decoder)
448448
metadata_dict = json.loads(metadata)
@@ -469,7 +469,7 @@ def test_get_ffmpeg_version(self):
469469
assert "ffmpeg_version" in ffmpeg_dict
470470

471471
def test_frame_pts_equality(self):
472-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
472+
decoder = create_from_file(str(NASA_VIDEO.path))
473473
add_video_stream(decoder)
474474

475475
# Note that for all of these tests, we store the return value of
@@ -489,7 +489,7 @@ def test_frame_pts_equality(self):
489489

490490
@pytest.mark.parametrize("color_conversion_library", ("filtergraph", "swscale"))
491491
def test_color_conversion_library(self, color_conversion_library):
492-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="approximate")
492+
decoder = create_from_file(str(NASA_VIDEO.path))
493493
_add_video_stream(decoder, color_conversion_library=color_conversion_library)
494494
frame0, *_ = get_next_frame(decoder)
495495
reference_frame0 = NASA_VIDEO.get_frame_data_by_index(0)
@@ -514,7 +514,7 @@ def test_color_conversion_library(self, color_conversion_library):
514514
def test_color_conversion_library_with_scaling(
515515
self, input_video, width_scaling_factor, height_scaling_factor
516516
):
517-
decoder = create_from_file(str(input_video.path), seek_mode="exact")
517+
decoder = create_from_file(str(input_video.path))
518518
add_video_stream(decoder)
519519
metadata = get_json_metadata(decoder)
520520
metadata_dict = json.loads(metadata)
@@ -529,7 +529,7 @@ def test_color_conversion_library_with_scaling(
529529
assert target_height != input_video.height
530530

531531
filtergraph_decoder = create_from_file(
532-
str(input_video.path), seek_mode="approximate"
532+
str(input_video.path)
533533
)
534534
_add_video_stream(
535535
filtergraph_decoder,
@@ -540,7 +540,7 @@ def test_color_conversion_library_with_scaling(
540540
filtergraph_frame0, _, _ = get_next_frame(filtergraph_decoder)
541541

542542
swscale_decoder = create_from_file(
543-
str(input_video.path), seek_mode="approximate"
543+
str(input_video.path)
544544
)
545545
_add_video_stream(
546546
swscale_decoder,
@@ -556,7 +556,7 @@ def test_color_conversion_library_with_scaling(
556556
def test_color_conversion_library_with_dimension_order(
557557
self, dimension_order, color_conversion_library
558558
):
559-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
559+
decoder = create_from_file(str(NASA_VIDEO.path))
560560
_add_video_stream(
561561
decoder,
562562
color_conversion_library=color_conversion_library,
@@ -641,7 +641,7 @@ def test_color_conversion_library_with_generated_videos(
641641
]
642642
subprocess.check_call(command)
643643

644-
decoder = create_from_file(str(video_path), seek_mode="exact")
644+
decoder = create_from_file(str(video_path))
645645
add_video_stream(decoder)
646646
metadata = get_json_metadata(decoder)
647647
metadata_dict = json.loads(metadata)
@@ -655,7 +655,7 @@ def test_color_conversion_library_with_generated_videos(
655655
if height_scaling_factor != 1.0:
656656
assert target_height != height
657657

658-
filtergraph_decoder = create_from_file(str(video_path), seek_mode="approximate")
658+
filtergraph_decoder = create_from_file(str(video_path))
659659
_add_video_stream(
660660
filtergraph_decoder,
661661
width=target_width,
@@ -664,7 +664,7 @@ def test_color_conversion_library_with_generated_videos(
664664
)
665665
filtergraph_frame0, _, _ = get_next_frame(filtergraph_decoder)
666666

667-
auto_decoder = create_from_file(str(video_path), seek_mode="approximate")
667+
auto_decoder = create_from_file(str(video_path))
668668
add_video_stream(
669669
auto_decoder,
670670
width=target_width,
@@ -675,7 +675,7 @@ def test_color_conversion_library_with_generated_videos(
675675

676676
@needs_cuda
677677
def test_cuda_decoder(self):
678-
decoder = create_from_file(str(NASA_VIDEO.path), seek_mode="exact")
678+
decoder = create_from_file(str(NASA_VIDEO.path))
679679
add_video_stream(decoder, device="cuda")
680680
frame0, pts, duration = get_next_frame(decoder)
681681
assert frame0.device.type == "cuda"

0 commit comments

Comments
 (0)