Skip to content

Commit af17983

Browse files
committed
Add test to illustrate audio bug
1 parent 8e611bb commit af17983

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/decoders/test_ops.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,23 @@ def test_pts(self, asset):
850850
else:
851851
assert pts_seconds == start_seconds
852852

853+
def test_decode_before_frame_start(self):
854+
# Test illustrating bug described in
855+
# https://github.com/pytorch/torchcodec/issues/567
856+
asset = NASA_AUDIO_MP3
857+
858+
decoder = create_from_file(str(asset.path), seek_mode="approximate")
859+
add_audio_stream(decoder)
860+
861+
frames, *_ = get_frames_by_pts_in_range_audio(
862+
decoder, start_seconds=0, stop_seconds=0.05
863+
)
864+
all_frames, *_ = get_frames_by_pts_in_range_audio(
865+
decoder, start_seconds=0, stop_seconds=None
866+
)
867+
# TODO fix this. `frames` should be empty.
868+
torch.testing.assert_close(frames, all_frames)
869+
853870

854871
if __name__ == "__main__":
855872
pytest.main()

0 commit comments

Comments
 (0)