2020-09-13 11:04:16 +02:00
|
|
|
// Package conn defines interfaces for connections and tracks.
|
|
|
|
package conn
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/pion/webrtc/v3"
|
|
|
|
)
|
|
|
|
|
|
|
|
var ErrConnectionClosed = errors.New("connection is closed")
|
|
|
|
|
|
|
|
// Type Up represents a connection in the client to server direction.
|
|
|
|
type Up interface {
|
|
|
|
AddLocal(Down) error
|
|
|
|
DelLocal(Down) bool
|
|
|
|
Id() string
|
2021-04-28 17:00:50 +02:00
|
|
|
Label() string
|
2021-01-03 12:04:39 +01:00
|
|
|
User() (string, string)
|
2020-09-13 11:04:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Type UpTrack represents a track in the client to server direction.
|
|
|
|
type UpTrack interface {
|
|
|
|
AddLocal(DownTrack) error
|
|
|
|
DelLocal(DownTrack) bool
|
2021-04-28 17:00:50 +02:00
|
|
|
Kind() webrtc.RTPCodecType
|
2021-04-29 17:03:25 +02:00
|
|
|
Label() string
|
2020-12-04 01:15:52 +01:00
|
|
|
Codec() webrtc.RTPCodecCapability
|
2020-09-13 11:04:16 +02:00
|
|
|
// get a recent packet. Returns 0 if the packet is not in cache.
|
|
|
|
GetRTP(seqno uint16, result []byte) uint16
|
2020-10-12 12:20:55 +02:00
|
|
|
Nack(conn Up, seqnos []uint16) error
|
2021-05-11 22:36:56 +02:00
|
|
|
RequestKeyframe() error
|
2020-09-13 11:04:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Type Down represents a connection in the server to client direction.
|
|
|
|
type Down interface {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Type DownTrack represents a track in the server to client direction.
|
|
|
|
type DownTrack interface {
|
2021-05-11 23:48:17 +02:00
|
|
|
Write(buf []byte) (int, error)
|
2020-09-13 11:04:16 +02:00
|
|
|
SetTimeOffset(ntp uint64, rtp uint32)
|
|
|
|
SetCname(string)
|
2021-05-11 15:28:30 +02:00
|
|
|
GetMaxBitrate() (uint64, int)
|
2020-09-13 11:04:16 +02:00
|
|
|
}
|