Skip to content

Commit 129e2e4

Browse files
committed
Make setMid of Transceiver public
in some case like session migration from one sfu node to another, we need manual set mid of transceiver instead of auto generate, to make mid consistent between to sfu node.
1 parent 425f5c6 commit 129e2e4

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

AUTHORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Konstantin Itskov <[email protected]>
8686
krishna chiatanya <[email protected]>
8787
Kuzmin Vladimir <[email protected]>
8888
89+
8990
Lukas Herman <[email protected]>
9091
9192
Luke Curley <[email protected]>

peerconnection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ func (pc *PeerConnection) CreateOffer(options *OfferOptions) (SessionDescription
660660
continue
661661
}
662662
pc.greaterMid++
663-
err = t.setMid(strconv.Itoa(pc.greaterMid))
663+
err = t.SetMid(strconv.Itoa(pc.greaterMid))
664664
if err != nil {
665665
return SessionDescription{}, err
666666
}
@@ -1092,7 +1092,7 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error {
10921092
}
10931093

10941094
if t.Mid() == "" {
1095-
if err := t.setMid(midValue); err != nil {
1095+
if err := t.SetMid(midValue); err != nil {
10961096
return err
10971097
}
10981098
}

rtptransceiver.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !js
12
// +build !js
23

34
package webrtc
@@ -115,8 +116,8 @@ func (t *RTPTransceiver) Receiver() *RTPReceiver {
115116
return nil
116117
}
117118

118-
// setMid sets the RTPTransceiver's mid. If it was already set, will return an error.
119-
func (t *RTPTransceiver) setMid(mid string) error {
119+
// SetMid sets the RTPTransceiver's mid. If it was already set, will return an error.
120+
func (t *RTPTransceiver) SetMid(mid string) error {
120121
if currentMid := t.Mid(); currentMid != "" {
121122
return fmt.Errorf("%w: %s to %s", errRTPTransceiverCannotChangeMid, currentMid, mid)
122123
}

0 commit comments

Comments
 (0)