client-sdk-js
bbc65dbe - fix(data-streams): accept text streams sent on behalf of another participant

Commit
3 days ago
fix(data-streams): accept text streams sent on behalf of another participant When an agent publishes a text stream under another participant's identity (for example a user's speech-to-text on lk.transcription), the SFU keeps the claimed identity on the header and marks it generated, but stamps the chunks and trailer with the agent's own identity. The sender check added in #2215 compared every chunk and trailer to the header's identity, so it dropped all of them and these streams never completed. The controller maps now hold a Descriptor per stream id, like IncomingDataTrackManager does, replacing the StreamController type. Alongside the controller, a Descriptor records the identity whose packets the stream accepts (packetSenderIdentity) separately from the identity it is attributed to (sendingParticipantIdentity). The two are the same for every stream except a generated text header, which starts with no accepted sender: the first chunk or trailer from a participant allowed to send on others' behalf claims the stream, and only that participant's packets are accepted after that. Chunk and trailer identities are asserted by the SFU, and only such a participant may claim, so a participant that saw the header still cannot write into the stream. The manager takes that permission as a canSendStreamOnOthersBehalf constructor callback, which the dataStreams extension wires to Participant.isAgent, since the SFU only lets agents publish under another identity. The stream still counts against the participant it is attributed to, and a participant disconnecting now also errors the streams it was sending on someone else's behalf.
Author
Committer
Parents
Loading