Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/lib/kt/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ Call `media.discontinuity()` when the source seeks, pauses, or changes its time
The three advertising operations: `moq.createBroadcast(path)` (or
`origin.createBroadcast`) returns an unannounced producer, invisible to everyone;
`broadcast.announce(route)` / `broadcast.unannounce()` own that exact-path
advertisement, and `broadcast.close()` (or `use { }`) releases the producer,
ending the broadcast once no `dynamic()` handle remains; `origin.dynamic(prefix, route)` claims `prefix` and every
advertisement; `broadcast.end()` ends the broadcast for good, while
`broadcast.close()` (or `use { }`) only releases the handle, ending the
broadcast once no `dynamic()` handle remains; `origin.dynamic(prefix, route)` claims `prefix` and every
path beneath it (`""` for everything). Hold the returned `OriginDynamic`
while the claim should stay advertised, and reject the requests you will not
serve. A route is a capability, not an inventory. `announcements(config)` takes
Expand Down
4 changes: 2 additions & 2 deletions kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Moq.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Moq internal constructor(
/**
* Create an unannounced broadcast at [path], invisible to everyone until announced.
*
* Advertise it with `announce` after populating tracks. `close()` (or `use`) ends it once no
* `dynamic()` handle remains.
* Advertise it with `announce` after populating tracks. `end()` ends it immediately;
* `close()` (or `use`) ends it once no `dynamic()` handle remains.
*/
fun createBroadcast(path: String): BroadcastProducer = session.publish().createBroadcast(path)

Expand Down
7 changes: 3 additions & 4 deletions kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Server.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ class Server internal constructor(
private val publishOrigin: OriginProducer?,
) : AutoCloseable {
/**
* Create a live broadcast at [path], served to incoming sessions.
* Create an unannounced broadcast at [path], served to incoming sessions once announced.
*
* The origin announces the path so subscribers can discover it, becoming visible
* Advertise it with `announce` after populating tracks. `close()` (or `use`)
* ends it once no `dynamic()` handle remains.
* Advertise it with `announce` after populating tracks. `end()` ends it immediately;
* `close()` (or `use`) ends it once no `dynamic()` handle remains.
*/
fun createBroadcast(path: String): BroadcastProducer {
val origin = publishOrigin ?: throw IllegalStateException("no publish origin configured")
Expand Down
13 changes: 13 additions & 0 deletions kt/moq/src/jvmAndAndroidTest/kotlin/dev/moq/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ class SmokeTest {
assertFailsWith<MoqException> { consumer.subscribeTrack("events", null) }
}

@Test
fun `end ends a broadcast while a dynamic handle is still held`() = runTest {
BroadcastProducer().use { broadcast ->
broadcast.dynamic().use {
val consumer = broadcast.consume()
broadcast.end()
broadcast.end()
assertFailsWith<MoqException> { consumer.subscribeTrack("events", null) }
assertFailsWith<MoqException> { broadcast.publishTrack("events", null) }
}
}
}

@Test
fun `broadcast updates shared video properties`() {
BroadcastProducer().use { broadcast ->
Expand Down
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ transport, benchmark tooling); worktrees isolate commits, not semantics.
- [Binding audio delay](/quest/m1/binding-surface.md) - moq-ffi, libmoq, and every wrapper configure and observe audio playout delay
- [FFI shape](/quest/m1/ffi-shape/README.md) - the bindings mirror Rust's layers: net at the root, then media, json, audio, and video namespaces built from the handle below
- [Track demand](/quest/m1/track-demand.md) - Rust and JS watch a track's subscribers through `demand()` alone
- [Kotlin end](/quest/m1/kotlin-end.md) - Kotlin exposes `close()` as `end()`, since `AutoCloseable.close()` takes the name
- [Error messages](/quest/m1/error-display.md) - Python, Go, and Dart print `MoqError` with Rust's message, as Kotlin and Swift do
- [Remove finish](/quest/m1/broadcast-remove.md) - on dev, the deprecated broadcast end APIs are gone and `closed()` carries no cause
- [CLI inspection](/quest/m1/cli-inspect/README.md) - `moq ls` lists what is live and `moq fetch` reads a group over MoQ, and a guide shows how to inspect a relay
Expand Down
1 change: 0 additions & 1 deletion quest/m1/broadcast-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ This is a published API break, so it targets `dev`.

## Required

- [Kotlin end](/quest/m1/kotlin-end.md) - Kotlin keeps a forced end once `finish` is gone
- `main` merged into `dev` once #4031 lands, so the deprecations exist there
14 changes: 0 additions & 14 deletions quest/m1/kotlin-end.md

This file was deleted.

9 changes: 4 additions & 5 deletions rs/moq-ffi/uniffi.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Kotlin objects are AutoCloseable, and `close()` there releases the handle,
# which ends the broadcast like dropping the last Rust producer. A generated
# `close()` would collide with it.
[bindings.kotlin]
exclude = ["MoqBroadcastProducer.close"]
# Kotlin objects are AutoCloseable, and `close()` there only releases the handle.
# A generated `close()` would collide with it, so Kotlin names the method `end()`.
[bindings.kotlin.rename]
"MoqBroadcastProducer.close" = "end"
Loading