diff --git a/cpp/obs/test/moq-output-test.cpp b/cpp/obs/test/moq-output-test.cpp index b883589d693..863220c4d28 100644 --- a/cpp/obs/test/moq-output-test.cpp +++ b/cpp/obs/test/moq-output-test.cpp @@ -522,6 +522,7 @@ int main() CHECK(WaitFor([&] { return output.IsLiveSession() && relay.Accepted() == 1; })); // The plugin names itself ahead of the C++ package, so a relay can tell it apart. CHECK(relay.Advertised("moq-obs/dev moq-cpp/")); + OutlastHealthy(); relay.DropSessions(); CHECK(WaitFor([&] { return output.GetReconnectCount() == 1 && output.IsLiveSession(); })); CHECK(MoQOutputStatsTest::Instance(output) == first); @@ -995,6 +996,7 @@ int main() MoQOutput o(nullptr, OUTPUT); CHECK(o.Start()); CHECK(WaitFor([&] { return o.IsLiveSession() && relay.Accepted() == 1; })); + OutlastHealthy(); relay.DropSessions(); CHECK(WaitFor([&] { return relay.Accepted() == 2; })); CHECK(WaitFor([&] { return o.GetReconnectCount() == 1; })); @@ -1013,6 +1015,7 @@ int main() MoQOutput o(nullptr, OUTPUT); CHECK(o.Start()); CHECK(WaitFor([&] { return o.IsLiveSession(); })); + OutlastHealthy(); relay.reset(); MoQOutput::ConnectionStats stats; CHECK(WaitFor([&] { return !o.TryGetConnectionStats(&stats); })); diff --git a/cpp/obs/test/moq-source-test.cpp b/cpp/obs/test/moq-source-test.cpp index ce170a70c4b..1533e68bef2 100644 --- a/cpp/obs/test/moq-source-test.cpp +++ b/cpp/obs/test/moq-source-test.cpp @@ -1769,6 +1769,7 @@ int main() Publisher publisher(relay, "obs/test"); void *source = createSource(); CHECK(publisher.WriteUntil([] { return g_output_frames > 0 && g_output_audio > 0; })); + OutlastHealthy(); relay.DropSessions(); CHECK(WaitFor([&] { return relay.Accepted() == 2; })); const int frames = g_output_frames; diff --git a/cpp/obs/test/moq-test-relay.h b/cpp/obs/test/moq-test-relay.h index ba5b206f1a0..71d006fdd73 100644 --- a/cpp/obs/test/moq-test-relay.h +++ b/cpp/obs/test/moq-test-relay.h @@ -57,6 +57,14 @@ inline bool WaitFor(const std::function &done, std::chrono::milliseconds return true; } +// Lets a session the test just saw go live outlast moq-ffi's healthy bar, which has no +// override: a session its peer closes sooner ends the client, as a refused one does, where +// one closed later redials. +inline void OutlastHealthy() +{ + std::this_thread::sleep_for(std::chrono::seconds(1)); +} + // Runs whatever `worker` already queued, so a test checks what an object's dropped calls // did without waiting out a window. Dropping a moq::Continuation does not recall a result // whose delivery already began, which can still queue after this returns: a check after