mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Add lint for filenames
We have established a pattern of Alpha and underscores for filenames. This adds a hook to keep this pattern going. Also fixes a misnamed file I found in the process. Resolves #456
This commit is contained in:
46
rtptransceiver.go
Normal file
46
rtptransceiver.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package webrtc
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid.
|
||||
type RTPTransceiver struct {
|
||||
Mid string
|
||||
Sender *RTPSender
|
||||
Receiver *RTPReceiver
|
||||
Direction RTPTransceiverDirection
|
||||
// currentDirection RTPTransceiverDirection
|
||||
// firedDirection RTPTransceiverDirection
|
||||
// receptive bool
|
||||
stopped bool
|
||||
}
|
||||
|
||||
func (t *RTPTransceiver) setSendingTrack(track *Track) error {
|
||||
t.Sender.track = track
|
||||
|
||||
switch t.Direction {
|
||||
case RTPTransceiverDirectionRecvonly:
|
||||
t.Direction = RTPTransceiverDirectionSendrecv
|
||||
case RTPTransceiverDirectionInactive:
|
||||
t.Direction = RTPTransceiverDirectionSendonly
|
||||
default:
|
||||
return errors.Errorf("Invalid state change in RTPTransceiver.setSending")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop irreversibly stops the RTPTransceiver
|
||||
func (t *RTPTransceiver) Stop() error {
|
||||
if t.Sender != nil {
|
||||
if err := t.Sender.Stop(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if t.Receiver != nil {
|
||||
if err := t.Receiver.Stop(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user