rtc: route answer to publisher in single-PC / one-shot mode

Correct the previous nil-guard: dropping the answer prevents the crash but
breaks subscribe renegotiation. In single-PC (UseSinglePeerConnection) and
one-shot signalling modes the single publisher PC carries both directions;
when the server renegotiates to push a subscribed track it offers on that PC
(NegotiateSubscriber -> publisher.Negotiate -> signalSendOffer) and the client
replies with an answer. Route that answer to the publisher, matching every
other subscriber-path method in TransportManager (GetSubscriberRTT,
AddTrackLocal, AddSubscribedTrack, NegotiateSubscriber, ...).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Erik Hortsch
2026-07-16 13:40:29 -07:00
co-authored by Claude Opus 4.8
parent 3432b21c5d
commit 67af635be7
+4 -5
View File
@@ -542,12 +542,11 @@ func (t *TransportManager) ProcessPendingPublisherOffer() {
}
func (t *TransportManager) HandleAnswer(answer webrtc.SessionDescription, answerId uint32) {
if t.subscriber == nil {
// no subscriber transport in single-PC / one-shot signalling mode
t.params.Logger.Warnw("answer received, but no subscriber peer connection", nil)
return
if t.params.UseOneShotSignallingMode || t.params.UseSinglePeerConnection {
t.publisher.HandleRemoteDescription(answer, answerId)
} else {
t.subscriber.HandleRemoteDescription(answer, answerId)
}
t.subscriber.HandleRemoteDescription(answer, answerId)
}
// AddICECandidate adds candidates for remote peer