From 742e1ba1f198479ac393063852a8ce73f173517d Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Thu, 26 Nov 2026 03:26:55 -0500 Subject: [PATCH 1/2] Apply suggested fix to tests/unit/test_config.c from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/unit/test_config.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_config.c b/tests/unit/test_config.c index 58952efb1..1f8940218 100644 --- a/tests/unit/test_config.c +++ b/tests/unit/test_config.c @@ -359,10 +359,22 @@ void test_mp4_faststart_concurrent_reads_copies_and_saves(void) { int save_result = 0; int valid_saves = 0; bool streams_distinct_ok = true; + bool writer_progress_ok = true; + struct timespec initial_wait_start = {0}; + TEST_ASSERT_EQUAL_INT(0, clock_gettime(CLOCK_MONOTONIC, &initial_wait_start)); while (atomic_load(&faststart_writer_updates) == 0) { + struct timespec now = {0}; + TEST_ASSERT_EQUAL_INT(0, clock_gettime(CLOCK_MONOTONIC, &now)); + long elapsed_ms = + (now.tv_sec - initial_wait_start.tv_sec) * 1000L + + (now.tv_nsec - initial_wait_start.tv_nsec) / 1000000L; + if (elapsed_ms > 2000L) { + writer_progress_ok = false; + atomic_store(&faststart_writer_stop, true); + break; + } sched_yield(); } - bool writer_progress_ok = true; for (int i = 0; i < 50; ++i) { (void)config_get_mp4_faststart(&cfg); config_t snapshot = {0}; From ca3344844f03cefa1871f61e606f0fc52bd0d99f Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Thu, 26 Nov 2026 03:32:09 -0500 Subject: [PATCH 2/2] Bound initial faststart writer wait with safe teardown --- tests/unit/test_config.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_config.c b/tests/unit/test_config.c index 1f8940218..85eee9217 100644 --- a/tests/unit/test_config.c +++ b/tests/unit/test_config.c @@ -361,21 +361,25 @@ void test_mp4_faststart_concurrent_reads_copies_and_saves(void) { bool streams_distinct_ok = true; bool writer_progress_ok = true; struct timespec initial_wait_start = {0}; - TEST_ASSERT_EQUAL_INT(0, clock_gettime(CLOCK_MONOTONIC, &initial_wait_start)); - while (atomic_load(&faststart_writer_updates) == 0) { + if (clock_gettime(CLOCK_MONOTONIC, &initial_wait_start) != 0) { + writer_progress_ok = false; + } + while (writer_progress_ok && atomic_load(&faststart_writer_updates) == 0) { struct timespec now = {0}; - TEST_ASSERT_EQUAL_INT(0, clock_gettime(CLOCK_MONOTONIC, &now)); + if (clock_gettime(CLOCK_MONOTONIC, &now) != 0) { + writer_progress_ok = false; + break; + } long elapsed_ms = (now.tv_sec - initial_wait_start.tv_sec) * 1000L + (now.tv_nsec - initial_wait_start.tv_nsec) / 1000000L; if (elapsed_ms > 2000L) { writer_progress_ok = false; - atomic_store(&faststart_writer_stop, true); break; } sched_yield(); } - for (int i = 0; i < 50; ++i) { + for (int i = 0; i < 50 && writer_progress_ok; ++i) { (void)config_get_mp4_faststart(&cfg); config_t snapshot = {0}; if (!config_copy(&snapshot, &cfg)) streams_distinct_ok = false;