mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Add requeststreaminfo so late joiners can find a running stream
Verified end to end against a live TS6 client: the passthrough delivers notifyrespondjoinstreamrequest with the full SDP offer plus 18 iceCandidate notifies, all correctly unescaped. Getting there turned up a gap. A client entering a channel where a stream is already running receives no stream command at all - 35 s in the channel produced zero undeclared commands. Discovery runs over the ordinary client_is_streaming property instead, and the stream id has to be pulled per client with requeststreaminfo. Without that, only a viewer who happened to be present when the stream started could ever join. The unknown-command names now go to stderr, which is what made the difference between "the server sent nothing" and "we filtered it out" visible at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
9f1a63c9d3
commit
11a413d2b6
1 file changed
+25
@@ -1464,6 +1464,27 @@ async fn run(args: Args) -> Result<()> {
|
||||
}
|
||||
Err(e) => emit(&Event::Error { message: e.to_string() }),
|
||||
}
|
||||
} else if let Some(rest) = l.strip_prefix("streaminfo ") {
|
||||
// A late joiner only learns *that* someone streams, from
|
||||
// the client_is_streaming property; the stream id has to
|
||||
// be pulled per client with this.
|
||||
match rest.trim().parse::<u16>() {
|
||||
Ok(clid) => {
|
||||
let mut packet = OutCommand::new(
|
||||
Direction::C2S,
|
||||
Flags::empty(),
|
||||
PacketType::Command,
|
||||
"requeststreaminfo",
|
||||
);
|
||||
packet.write_arg("clid", &clid);
|
||||
if let Err(e) = packet.send(&mut con) {
|
||||
emit(&Event::Error { message: format!("requeststreaminfo failed: {e}") });
|
||||
}
|
||||
}
|
||||
Err(_) => emit(&Event::Error {
|
||||
message: format!("Invalid client id: {rest}"),
|
||||
}),
|
||||
}
|
||||
} else if let Some(rest) = l.strip_prefix("streamjoin ") {
|
||||
// "streamjoin <stream-id> <clid> [msg]" - ask the client
|
||||
// publishing a TS6 stream to let us in. Its reply is a
|
||||
@@ -2470,6 +2491,10 @@ async fn run(args: Args) -> Result<()> {
|
||||
}
|
||||
}
|
||||
Some(Ok(StreamItem::UnknownCommand { name, content })) => {
|
||||
// Undeclared commands are invisible everywhere else, so name
|
||||
// them on stderr - that is the only way to tell "the server
|
||||
// sent nothing" apart from "we filtered it out".
|
||||
eprintln!("[unknown-command] {name}");
|
||||
// TS6 Stream/Call signaling. Everything else undeclared is
|
||||
// dropped on purpose - forwarding every unknown command
|
||||
// would turn this into a firehose, and nothing downstream
|
||||
|
||||
Reference in new issue
Block a user