2020-09-13 11:04:16 +02:00
|
|
|
// Package conn defines interfaces for connections and tracks.
|
|
|
|
package conn
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2024-10-27 13:08:55 +01:00
|
|
|
"github.com/pion/webrtc/v4"
|
2020-09-13 11:04:16 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2021-07-14 14:20:52 +02:00
|
|
|
// GetPacket fetches a recent packet. Returns 0 if the packet is
|
|
|
|
// not in cache, and, in that case, optionally schedules a NACK.
|
|
|
|
GetPacket(seqno uint16, result []byte, nack bool) uint16
|
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-17 16:23:07 +02:00
|
|
|
GetMaxBitrate() (uint64, int, int)
|
2020-09-13 11:04:16 +02:00
|
|
|
}
|