@@ -986,6 +986,31 @@ def get_some_frames(decoder):
986986 assert_frames_equal (ref_frame3 , frames [1 ].data )
987987 assert_frames_equal (ref_frame5 , frames [2 ].data )
988988
989+ def test_video_with_bad_packet_pts_metadata (self ):
990+ path = "/home/nicolashug/Downloads/sample_video_2.avi"
991+
992+ approx_metadata = VideoDecoder (path , seek_mode = "approximate" ).metadata
993+ exact_metadata = VideoDecoder (path , seek_mode = "exact" ).metadata
994+
995+ INT64_MIN_SECONDS = - 3.0830212936561926e17
996+
997+ assert approx_metadata .duration_seconds_from_header == 9.02507
998+ assert approx_metadata .duration_seconds == 9.02507
999+ assert exact_metadata .duration_seconds_from_header == 9.02507
1000+ assert exact_metadata .duration_seconds == 0
1001+
1002+ assert approx_metadata .begin_stream_seconds_from_header == 0
1003+ assert approx_metadata .begin_stream_seconds_from_content is None
1004+ assert approx_metadata .begin_stream_seconds == 0
1005+ assert exact_metadata .begin_stream_seconds_from_header == 0
1006+ assert exact_metadata .begin_stream_seconds_from_content == INT64_MIN_SECONDS
1007+ assert exact_metadata .begin_stream_seconds == INT64_MIN_SECONDS
1008+
1009+ assert approx_metadata .end_stream_seconds_from_content is None
1010+ assert approx_metadata .end_stream_seconds == 9.02507
1011+ assert exact_metadata .end_stream_seconds_from_content == INT64_MIN_SECONDS
1012+ assert exact_metadata .end_stream_seconds == INT64_MIN_SECONDS
1013+
9891014
9901015class TestAudioDecoder :
9911016 @pytest .mark .parametrize ("asset" , (NASA_AUDIO , NASA_AUDIO_MP3 , SINE_MONO_S32 ))
0 commit comments