From d851945aad27ccfdee47a3f2b1bc7c9f4fa93a52 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Wed, 19 Jun 2024 23:08:40 -0500 Subject: [PATCH] Tests/LibMedia: Ensure that frame timestamps increase monotonically --- Tests/LibMedia/TestMediaCommon.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/LibMedia/TestMediaCommon.h b/Tests/LibMedia/TestMediaCommon.h index 92be4649fcb..0aedb9d1ae6 100644 --- a/Tests/LibMedia/TestMediaCommon.h +++ b/Tests/LibMedia/TestMediaCommon.h @@ -28,6 +28,8 @@ static inline void decode_video(StringView path, size_t expected_frame_count, T size_t frame_count = 0; NonnullOwnPtr decoder = create_decoder(iterator); + auto last_timestamp = Duration::min(); + while (frame_count <= expected_frame_count) { auto block_result = iterator.next_block(); if (block_result.is_error() && block_result.error().category() == Media::DecoderErrorCategory::EndOfStream) { @@ -45,6 +47,8 @@ static inline void decode_video(StringView path, size_t expected_frame_count, T break; VERIFY_NOT_REACHED(); } + EXPECT(last_timestamp <= frame_result.value()->timestamp()); + last_timestamp = frame_result.value()->timestamp(); } frame_count++; }