mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Implement RemoveTrack
RemoveTrack properly removes the Sender, and culls the RtpReceiver on the remote Relates to #207
This commit is contained in:
@@ -19,17 +19,17 @@ type RTPTransceiver struct {
|
||||
}
|
||||
|
||||
func (t *RTPTransceiver) setSendingTrack(track *Track) error {
|
||||
if track == nil {
|
||||
return fmt.Errorf("track must not be nil")
|
||||
}
|
||||
|
||||
t.Sender.track = track
|
||||
|
||||
switch t.Direction {
|
||||
case RTPTransceiverDirectionRecvonly:
|
||||
switch {
|
||||
case track != nil && t.Direction == RTPTransceiverDirectionRecvonly:
|
||||
t.Direction = RTPTransceiverDirectionSendrecv
|
||||
case RTPTransceiverDirectionInactive:
|
||||
case track != nil && t.Direction == RTPTransceiverDirectionInactive:
|
||||
t.Direction = RTPTransceiverDirectionSendonly
|
||||
case track == nil && t.Direction == RTPTransceiverDirectionSendrecv:
|
||||
t.Direction = RTPTransceiverDirectionRecvonly
|
||||
case track == nil && t.Direction == RTPTransceiverDirectionSendonly:
|
||||
t.Direction = RTPTransceiverDirectionInactive
|
||||
default:
|
||||
return fmt.Errorf("invalid state change in RTPTransceiver.setSending")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user