From b2f9afcec2ab70eeb3c225e9efc27718829f034a Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 26 Sep 2026 14:16:30 -0700 Subject: [PATCH 1/3] feat(cpp)!: export the C++ package as moq::cpp One moq:: namespace for every CMake package: find_package(moq-cpp) links moq::cpp (was moq-cpp::moq), matching moq::c from find_package(moq-c). The internal imported staticlib is moq::ffi. Co-Authored-By: Claude Opus 5.5 --- cpp/moq/CMakeLists.txt | 2 +- cpp/moq/README.md | 2 +- cpp/moq/cmake/moq-cpp-config.cmake.in | 14 +++++++------- cpp/moq/test/CMakeLists.txt | 2 +- doc/lib/cpp/index.md | 4 ++-- test/interop/clients/cpp/CMakeLists.txt | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cpp/moq/CMakeLists.txt b/cpp/moq/CMakeLists.txt index 780b3f5b562..ae9209d71dc 100644 --- a/cpp/moq/CMakeLists.txt +++ b/cpp/moq/CMakeLists.txt @@ -76,7 +76,7 @@ endforeach() # The bindings compile here with the including project's standard and flags; see src/moq.cpp. # Named moq-cpp so an in-tree build can sit beside libmoq's `moq` target. add_library(moq-cpp STATIC src/moq.cpp) -add_library(moq-cpp::moq ALIAS moq-cpp) +add_library(moq::cpp ALIAS moq-cpp) add_dependencies(moq-cpp moq_ffi) target_compile_features(moq-cpp PUBLIC cxx_std_17) target_include_directories(moq-cpp PUBLIC diff --git a/cpp/moq/README.md b/cpp/moq/README.md index 6545172fa74..274f76f116f 100644 --- a/cpp/moq/README.md +++ b/cpp/moq/README.md @@ -4,7 +4,7 @@ C++17 bindings for [rs/moq-ffi](../../rs/moq-ffi): the sources `uniffi-bindgen-c ## Layout -- `CMakeLists.txt` builds moq-ffi as a staticlib with cargo, renders the bindings into the build tree, and compiles them as the `moq-cpp::moq` target. Use it with `add_subdirectory`, or install it for `find_package(moq-cpp)` and `moq-cpp.pc`. +- `CMakeLists.txt` builds moq-ffi as a staticlib with cargo, renders the bindings into the build tree, and compiles them as the `moq::cpp` target. Use it with `add_subdirectory`, or install it for `find_package(moq-cpp)` and `moq-cpp.pc`. - `src/moq.cpp` compiles the generated `moq/ffi/moq.cpp`. It ships as source so it builds with the consumer's standard and flags. - `cmake/` holds the installed CMake package and pkg-config templates. - `build.sh` builds the release archive `release-cpp.yml` publishes. diff --git a/cpp/moq/cmake/moq-cpp-config.cmake.in b/cpp/moq/cmake/moq-cpp-config.cmake.in index 1383fb754f7..d4ed0477fbf 100644 --- a/cpp/moq/cmake/moq-cpp-config.cmake.in +++ b/cpp/moq/cmake/moq-cpp-config.cmake.in @@ -1,15 +1,15 @@ -# find_package(moq-cpp): the C++ bindings for moq-ffi as the moq-cpp::moq target. The -# namespace is the package name, so it never collides with libmoq's moq::moq. +# find_package(moq-cpp): the C++ bindings for moq-ffi as the moq::cpp target. Every moq +# package exports into the one moq:: namespace, and the package names keep installs apart. @PACKAGE_INIT@ -if(NOT TARGET moq-cpp::moq) +if(NOT TARGET moq::cpp) find_package(Threads REQUIRED) # The prebuilt Rust staticlib, and the system libraries an external linker must add for # it, baked in for the platform this package was built for. - add_library(moq-cpp::ffi STATIC IMPORTED) - set_target_properties(moq-cpp::ffi PROPERTIES + add_library(moq::ffi STATIC IMPORTED) + set_target_properties(moq::ffi PROPERTIES IMPORTED_LOCATION "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@MOQ_FFI_LIB_NAME@" INTERFACE_LINK_LIBRARIES "@MOQ_NATIVE_LIBS@;Threads::Threads" ) @@ -19,8 +19,8 @@ if(NOT TARGET moq-cpp::moq) add_library(moq-cpp STATIC "@PACKAGE_CMAKE_INSTALL_DATADIR@/moq-cpp/moq.cpp") target_compile_features(moq-cpp PUBLIC cxx_std_17) target_include_directories(moq-cpp PUBLIC "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") - target_link_libraries(moq-cpp PUBLIC moq-cpp::ffi) - add_library(moq-cpp::moq ALIAS moq-cpp) + target_link_libraries(moq-cpp PUBLIC moq::ffi) + add_library(moq::cpp ALIAS moq-cpp) endif() check_required_components(moq-cpp) diff --git a/cpp/moq/test/CMakeLists.txt b/cpp/moq/test/CMakeLists.txt index b76f382000f..c7c7d16e9de 100644 --- a/cpp/moq/test/CMakeLists.txt +++ b/cpp/moq/test/CMakeLists.txt @@ -21,4 +21,4 @@ endif() find_package(moq-cpp REQUIRED) add_executable(probe probe.cpp) -target_link_libraries(probe PRIVATE moq-cpp::moq) +target_link_libraries(probe PRIVATE moq::cpp) diff --git a/doc/lib/cpp/index.md b/doc/lib/cpp/index.md index 751ce0083cb..0f1b40acd4b 100644 --- a/doc/lib/cpp/index.md +++ b/doc/lib/cpp/index.md @@ -26,7 +26,7 @@ No Rust toolchain is needed to consume it. ```cmake ignore find_package(moq-cpp REQUIRED) # with CMAKE_PREFIX_PATH at the unpacked archive -target_link_libraries(app PRIVATE moq-cpp::moq) +target_link_libraries(app PRIVATE moq::cpp) ``` ```bash @@ -44,7 +44,7 @@ release runtime (`/MD`), which the Rust library uses in every configuration. From source, `add_subdirectory(cpp/moq)` in a checkout builds `moq-ffi` with cargo and renders the bindings with the pinned `uniffi-bindgen-cpp` (see [`cpp/moq`](https://github.com/moq-dev/moq/tree/main/cpp/moq)), then exposes -the same `moq-cpp::moq` target. The package is `moq-cpp`, so it installs beside +the same `moq::cpp` target. The package is `moq-cpp`, so it installs beside libmoq's `moq` package without colliding. ## Example diff --git a/test/interop/clients/cpp/CMakeLists.txt b/test/interop/clients/cpp/CMakeLists.txt index b1ad0c3d348..894e8caaf95 100644 --- a/test/interop/clients/cpp/CMakeLists.txt +++ b/test/interop/clients/cpp/CMakeLists.txt @@ -10,4 +10,4 @@ set(CMAKE_CXX_EXTENSIONS OFF) find_package(moq-cpp REQUIRED) add_executable(cpp-interop main.cpp) -target_link_libraries(cpp-interop PRIVATE moq-cpp::moq) +target_link_libraries(cpp-interop PRIVATE moq::cpp) From 2de1b32966224d56f431e46e6c103922441750e5 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 26 Sep 2026 18:35:05 -0700 Subject: [PATCH 2/3] test(media): wait past the fixture's frame at detach before asserting reattach The reattached canvas still shows the last frame painted before the detach, and the relay may replay its cached group from then, so a baseline read before the detach let the stale canvas satisfy the resume check and the replayed group then read as the picture going backwards. Co-Authored-By: Claude Opus 5.5 --- test/interop/clients/js/media.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/interop/clients/js/media.ts b/test/interop/clients/js/media.ts index 6ac033f31b2..1595f861edb 100644 --- a/test/interop/clients/js/media.ts +++ b/test/interop/clients/js/media.ts @@ -621,12 +621,16 @@ try { }); console.error(" detach released every session, audio graph, and worker"); + // The reattached canvas still holds the last frame painted before the detach, and the relay + // may replay its cached group from before it too. Only a frame the fixture emits after this + // point proves the new session is playing. + const detached = (await readFixtureState(publisher)).frameId; await command(player, "reattach"); await waitForState(player, playerErrors, { deadline: Date.now() + timeoutMs, assertion: "reattach resumes playback", - description: `the presented frame to move past the ${busy.frameId} showing before the detach`, - predicate: (state) => (state.frameId ?? 0) > (busy.frameId ?? 0), + description: `the presented frame to move past the ${detached} the fixture had emitted by the detach`, + predicate: (state) => (state.frameId ?? 0) > detached, }); assertMedia(await collect(player, playerErrors, WINDOW_MS), "after reattach"); } From c7d49f8fdb792cd05d351ad6507b120167eb2e7b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 26 Sep 2026 20:08:11 -0700 Subject: [PATCH 3/3] Revert "test(media): wait past the fixture's frame at detach before asserting reattach" This reverts commit 2de1b3296. The canonical fix clears the canvas on reattach (#4308 on main, #4292 on this line), so the repo keeps one fix. Co-Authored-By: Claude Opus 5.5 --- test/interop/clients/js/media.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/interop/clients/js/media.ts b/test/interop/clients/js/media.ts index 1595f861edb..6ac033f31b2 100644 --- a/test/interop/clients/js/media.ts +++ b/test/interop/clients/js/media.ts @@ -621,16 +621,12 @@ try { }); console.error(" detach released every session, audio graph, and worker"); - // The reattached canvas still holds the last frame painted before the detach, and the relay - // may replay its cached group from before it too. Only a frame the fixture emits after this - // point proves the new session is playing. - const detached = (await readFixtureState(publisher)).frameId; await command(player, "reattach"); await waitForState(player, playerErrors, { deadline: Date.now() + timeoutMs, assertion: "reattach resumes playback", - description: `the presented frame to move past the ${detached} the fixture had emitted by the detach`, - predicate: (state) => (state.frameId ?? 0) > detached, + description: `the presented frame to move past the ${busy.frameId} showing before the detach`, + predicate: (state) => (state.frameId ?? 0) > (busy.frameId ?? 0), }); assertMedia(await collect(player, playerErrors, WINDOW_MS), "after reattach"); }