@@ -697,22 +697,24 @@ def test_get_frames_by_pts_in_range_audio(self, range, asset):
697697
698698 torch .testing .assert_close (frames , reference_frames )
699699
700- @pytest .mark .parametrize (
701- "asset, expected_shape" , ((NASA_AUDIO , (2 , 1024 )), (NASA_AUDIO_MP3 , (2 , 576 )))
702- )
703- def test_decode_epsilon_range (self , asset , expected_shape ):
700+ @pytest .mark .parametrize ("asset" , (NASA_AUDIO , NASA_AUDIO_MP3 ))
701+ def test_decode_epsilon_range (self , asset ):
704702 decoder = create_from_file (str (asset .path ), seek_mode = "approximate" )
705703 add_audio_stream (decoder )
706704
705+ start_seconds = 5
707706 frames = get_frames_by_pts_in_range_audio (
708- decoder , start_seconds = 5 , stop_seconds = 5 + 1e-5
707+ decoder , start_seconds = start_seconds , stop_seconds = start_seconds + 1e-5
708+ )
709+ torch .testing .assert_close (
710+ frames ,
711+ asset .get_frame_data_by_index (
712+ asset .get_frame_index (pts_seconds = start_seconds )
713+ ),
709714 )
710- assert frames .shape == expected_shape
711715
712- @pytest .mark .parametrize (
713- "asset, expected_shape" , ((NASA_AUDIO , (2 , 1024 )), (NASA_AUDIO_MP3 , (2 , 576 )))
714- )
715- def test_decode_just_one_frame_at_boundaries (self , asset , expected_shape ):
716+ @pytest .mark .parametrize ("asset" , (NASA_AUDIO , NASA_AUDIO_MP3 ))
717+ def test_decode_just_one_frame_at_boundaries (self , asset ):
716718 decoder = create_from_file (str (asset .path ), seek_mode = "approximate" )
717719 add_audio_stream (decoder )
718720
@@ -721,7 +723,12 @@ def test_decode_just_one_frame_at_boundaries(self, asset, expected_shape):
721723 frames = get_frames_by_pts_in_range_audio (
722724 decoder , start_seconds = start_seconds , stop_seconds = stop_seconds
723725 )
724- assert frames .shape == expected_shape
726+ torch .testing .assert_close (
727+ frames ,
728+ asset .get_frame_data_by_index (
729+ asset .get_frame_index (pts_seconds = start_seconds )
730+ ),
731+ )
725732
726733 @pytest .mark .parametrize ("asset" , (NASA_AUDIO , NASA_AUDIO_MP3 ))
727734 def test_decode_start_equal_stop (self , asset ):
0 commit comments