From 75e9f49ea476a2c7bd59ede68b8396229f09b143 Mon Sep 17 00:00:00 2001 From: Mohammad Reza Bayat Date: Mon, 14 Jul 2025 11:23:46 +0100 Subject: [PATCH 1/2] Remove obsolete `stream_index` from decoder benchmark calls The `stream_index` argument was removed from the decoding methods, but some benchmark invocations in `benchmark_decoders_library.py` were still passing it. This commit cleans up those calls by removing the outdated parameter to match the updated method signatures. Fixes #779 --- benchmarks/decoders/benchmark_decoders_library.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/decoders/benchmark_decoders_library.py b/benchmarks/decoders/benchmark_decoders_library.py index bd1c2f1c4..dee4ddacd 100644 --- a/benchmarks/decoders/benchmark_decoders_library.py +++ b/benchmarks/decoders/benchmark_decoders_library.py @@ -241,7 +241,7 @@ def decode_frames(self, video_file, pts_list): metadata = json.loads(get_json_metadata(decoder)) best_video_stream = metadata["bestVideoStreamIndex"] frames, *_ = get_frames_by_pts( - decoder, stream_index=best_video_stream, timestamps=pts_list + decoder, timestamps=pts_list ) return frames @@ -359,7 +359,7 @@ def decode_frames(self, video_file, pts_list): metadata = json.loads(get_json_metadata(decoder)) best_video_stream = metadata["bestVideoStreamIndex"] frames, *_ = get_frames_by_pts( - decoder, stream_index=best_video_stream, timestamps=pts_list + decoder, timestamps=pts_list ) return frames @@ -375,7 +375,7 @@ def decode_first_n_frames(self, video_file, n): best_video_stream = metadata["bestVideoStreamIndex"] indices_list = list(range(n)) frames, *_ = get_frames_at_indices( - decoder, stream_index=best_video_stream, frame_indices=indices_list + decoder, frame_indices=indices_list ) return frames From 150fcfe367efe51e6d2ea1354f31c74e4aefe8eb Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Mon, 14 Jul 2025 14:34:03 +0100 Subject: [PATCH 2/2] Fix linter --- .../decoders/benchmark_decoders_library.py | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/benchmarks/decoders/benchmark_decoders_library.py b/benchmarks/decoders/benchmark_decoders_library.py index dee4ddacd..507fc9f0c 100644 --- a/benchmarks/decoders/benchmark_decoders_library.py +++ b/benchmarks/decoders/benchmark_decoders_library.py @@ -1,5 +1,4 @@ import abc -import json import subprocess import typing import urllib.request @@ -20,7 +19,6 @@ create_from_file, get_frames_at_indices, get_frames_by_pts, - get_json_metadata, get_next_frame, seek_to_pts, ) @@ -238,11 +236,7 @@ def decode_frames(self, video_file, pts_list): color_conversion_library=self._color_conversion_library, device=self._device, ) - metadata = json.loads(get_json_metadata(decoder)) - best_video_stream = metadata["bestVideoStreamIndex"] - frames, *_ = get_frames_by_pts( - decoder, timestamps=pts_list - ) + frames, *_ = get_frames_by_pts(decoder, timestamps=pts_list) return frames def decode_first_n_frames(self, video_file, n): @@ -356,11 +350,7 @@ def decode_frames(self, video_file, pts_list): color_conversion_library=self._color_conversion_library, device=self._device, ) - metadata = json.loads(get_json_metadata(decoder)) - best_video_stream = metadata["bestVideoStreamIndex"] - frames, *_ = get_frames_by_pts( - decoder, timestamps=pts_list - ) + frames, *_ = get_frames_by_pts(decoder, timestamps=pts_list) return frames def decode_first_n_frames(self, video_file, n): @@ -371,12 +361,8 @@ def decode_first_n_frames(self, video_file, n): color_conversion_library=self._color_conversion_library, device=self._device, ) - metadata = json.loads(get_json_metadata(decoder)) - best_video_stream = metadata["bestVideoStreamIndex"] indices_list = list(range(n)) - frames, *_ = get_frames_at_indices( - decoder, frame_indices=indices_list - ) + frames, *_ = get_frames_at_indices(decoder, frame_indices=indices_list) return frames