feat: Create MultiInputStream API primitive#1036
Conversation
🦋 Changeset detectedLatest commit: cc2fcf1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughAdds a new MultiInputStream primitive that merges multiple ReadableStream inputs into a single output stream with dynamic add/remove and close semantics. Replaces previous DeferredReadableStream usage in AudioInput, RecorderIO, and ParticipantAudioInputStream to enable runtime input management. Changes
Sequence DiagramsequenceDiagram
participant Client
participant AudioInput
participant MultiInputStream
participant InputStreams as Input<br/>Streams
participant OutputStream
Client->>AudioInput: create AudioInput
AudioInput->>MultiInputStream: new MultiInputStream()
rect rgba(100,150,200,0.5)
Client->>AudioInput: attach input source
AudioInput->>MultiInputStream: addInputStream(source)
MultiInputStream-->>AudioInput: input ID
end
rect rgba(150,100,200,0.5)
MultiInputStream->>InputStreams: read() (concurrent pumps)
InputStreams-->>MultiInputStream: data chunk
MultiInputStream->>OutputStream: write(chunk)
end
rect rgba(100,200,150,0.5)
Client->>AudioInput: remove/swap input
AudioInput->>MultiInputStream: removeInputStream(id)
MultiInputStream->>MultiInputStream: cancel pump / release reader
end
rect rgba(200,150,100,0.5)
Client->>AudioInput: close
AudioInput->>MultiInputStream: close()
MultiInputStream->>MultiInputStream: detach inputs / await pumps
MultiInputStream->>OutputStream: close writer
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…it/agents-js into brian/allow-user-reconnect
|
@codex review |
This class could solves the issue where user want the room to stay alive event after participant disconnected and being able to pipe the audio stream from new participants.
Related PR: #1018
Summary by CodeRabbit
New Features
Bug Fixes / Reliability
Tests