mirror of
https://github.com/jech/galene.git
synced 2024-11-14 04:35:57 +01:00
be73380f9f
We used to label tracks individually, in a view to using the labelling for simulcast. Since then, the WebRTC community has converged on a different strategy, where multiple tracks share a single mid and are labelled with the rid extension. We now label whole streams, which is simpler, and use the track's kind (and, in the future, the rid) to disambiguate. This changes the protocol in two ways: * in offers, the "labels" dictionary is replaced by a single "label" field; and * the syntax of the "request" message has changed.
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
// Package conn defines interfaces for connections and tracks.
|
|
package conn
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/pion/rtp"
|
|
"github.com/pion/webrtc/v3"
|
|
)
|
|
|
|
var ErrConnectionClosed = errors.New("connection is closed")
|
|
var ErrKeyframeNeeded = errors.New("keyframe needed")
|
|
|
|
// Type Up represents a connection in the client to server direction.
|
|
type Up interface {
|
|
AddLocal(Down) error
|
|
DelLocal(Down) bool
|
|
Id() string
|
|
Label() string
|
|
User() (string, string)
|
|
}
|
|
|
|
// Type UpTrack represents a track in the client to server direction.
|
|
type UpTrack interface {
|
|
AddLocal(DownTrack) error
|
|
DelLocal(DownTrack) bool
|
|
Kind() webrtc.RTPCodecType
|
|
Codec() webrtc.RTPCodecCapability
|
|
// get a recent packet. Returns 0 if the packet is not in cache.
|
|
GetRTP(seqno uint16, result []byte) uint16
|
|
Nack(conn Up, seqnos []uint16) error
|
|
}
|
|
|
|
// Type Down represents a connection in the server to client direction.
|
|
type Down interface {
|
|
GetMaxBitrate(now uint64) uint64
|
|
}
|
|
|
|
// Type DownTrack represents a track in the server to client direction.
|
|
type DownTrack interface {
|
|
WriteRTP(packat *rtp.Packet) error
|
|
Accumulate(bytes uint32)
|
|
SetTimeOffset(ntp uint64, rtp uint32)
|
|
SetCname(string)
|
|
}
|