Repository navigation
Add Transport interface and move RTCEngine peer connections behind it - #1064
Conversation
RTCEngine now holds a Transport instead of separate publisher and subscriber fields. DualPeerConnectionTransport implements it for the existing two peer connection setup and owns the decisions that depend on that arrangement: ICE candidate routing, answering server offers, which peer connections a resume waits on, and the sync state descriptions. Whether to negotiate the publisher on join stays a transport decision, with hasPublished kept in the engine across full reconnects. The interface also covers what a single peer connection needs, with DualPeerConnectionTransport keeping today's behavior: - applyServerAnswer takes the answer's mid_to_track_id, now passed through SignalClient.Listener.onServerAnswer. - trackIdForReceiver resolves a remote track's ID from that mapping; Room.onAddTrack prefers it over the stream ID when present. - handleMediaSectionsRequirement handles the MediaSectionsRequirement signal message, which SignalClient now forwards. Either gains isLeft/isRight with smart-cast contracts.
🦋 Changeset detectedLatest commit: 913fa51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Diffuse output: Base AAR cache miss. Please run the build job on main to generate the base AAR. |
…ated Both peer connections are locals until the DualPeerConnectionTransport is assigned, so a failure creating the subscriber left the publisher with no owner: its native PeerConnection has no finalizer and closeResources could not reach it.
Transport and DualPeerConnectionTransport suppress TooManyFunctions, as DataStreams does. The baseline entries for the test-only peer connection getters now match their transport!! form.
| val publisher = pctFactory.create( | ||
| rtcConfig, | ||
| publisherObserver, | ||
| publisherObserver, | ||
| ) | ||
| subscriber?.close() | ||
| subscriber = pctFactory.create( | ||
| rtcConfig, | ||
| subscriberObserver, | ||
| null, | ||
| ) | ||
| val subscriber = runCatching { pctFactory.create(rtcConfig, subscriberObserver, null) } | ||
| .onFailure { publisher.close() } | ||
| .getOrThrow() |
There was a problem hiding this comment.
is this still a concern for RTCEngine or is this a concern for DualPeerConnectionTransport?
There was a problem hiding this comment.
The creation of the publisher and subscriber is staying with RTCEngine, so it's a concern for the engine.
There was a problem hiding this comment.
I see, I guess my question is why it's still on the engine.
There was a problem hiding this comment.
mainly, it's a smaller delta, so easier to review and ensure correctness.
| * Whether the publisher connects only once something is published or sent, rather than | ||
| * as part of joining. | ||
| */ | ||
| val publisherConnectsOnDemand: Boolean |
There was a problem hiding this comment.
this looks unused? Is this for single peer connection?
There was a problem hiding this comment.
Yes. The unused fields are for single peer connection.
RTCEngine now holds a
Transportinstead of separate publisher and subscriber fields.DualPeerConnectionTransportimplements it for the existing two peer connection setup and owns the decisions that depend on that arrangement: ICE candidate routing, answering server offers, which peer connections a resume waits on, and the sync state descriptions. Whether to negotiate the publisher on join stays a transport decision, withhasPublishedkept in the engine across full reconnects.The interface also covers what a single peer connection will need, with
DualPeerConnectionTransportkeeping today's behavior:applyServerAnswertakes the answer'smid_to_track_id, now passed throughSignalClient.Listener.onServerAnswer.trackIdForReceiverresolves a remote track's ID from that mapping;Room.onAddTrackprefers it over the stream ID when present.handleMediaSectionsRequirementhandles theMediaSectionsRequirementsignal message, whichSignalClientnow forwards.EithergainsisLeft/isRightwith smart-cast contracts.No behavior changes. This is the first of a series of PRs toward single peer connection support via
/rtc/v1.