2020-05-22 22:29:31 +02:00
|
|
|
// Copyright (c) 2020 by Juliusz Chroboczek.
|
|
|
|
|
|
|
|
// This is not open source software. Copy it, and I'll break into your
|
|
|
|
// house and tell your three year-old that Santa doesn't exist.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-05-22 23:07:38 +02:00
|
|
|
"errors"
|
2020-05-22 22:29:31 +02:00
|
|
|
|
2020-05-26 16:50:20 +02:00
|
|
|
"github.com/pion/rtp"
|
2020-05-22 22:29:31 +02:00
|
|
|
"github.com/pion/webrtc/v2"
|
|
|
|
)
|
|
|
|
|
2020-05-30 03:36:15 +02:00
|
|
|
var ErrConnectionClosed = errors.New("connection is closed")
|
2020-06-08 22:14:28 +02:00
|
|
|
var ErrKeyframeNeeded = errors.New("keyframe needed")
|
2020-05-30 03:36:15 +02:00
|
|
|
|
2020-06-08 22:14:28 +02:00
|
|
|
type upConnection interface {
|
|
|
|
addLocal(downConnection) error
|
|
|
|
delLocal(downConnection) bool
|
|
|
|
Id() string
|
|
|
|
Label() string
|
2020-05-22 22:29:31 +02:00
|
|
|
}
|
|
|
|
|
2020-06-08 22:14:28 +02:00
|
|
|
type upTrack interface {
|
|
|
|
addLocal(downTrack) error
|
|
|
|
delLocal(downTrack) bool
|
|
|
|
Label() string
|
|
|
|
Codec() *webrtc.RTPCodec
|
|
|
|
// get a recent packet. Returns 0 if the packet is not in cache.
|
|
|
|
getRTP(seqno uint16, result []byte) uint16
|
|
|
|
// returns the last timestamp, if possible
|
|
|
|
getTimestamp() (uint32, bool)
|
2020-05-22 22:29:31 +02:00
|
|
|
}
|
|
|
|
|
2020-06-08 22:14:28 +02:00
|
|
|
type downConnection interface {
|
|
|
|
Close() error
|
2020-05-22 22:29:31 +02:00
|
|
|
}
|
|
|
|
|
2020-05-26 17:44:21 +02:00
|
|
|
type downTrack interface {
|
|
|
|
WriteRTP(packat *rtp.Packet) error
|
|
|
|
Accumulate(bytes uint32)
|
|
|
|
GetMaxBitrate(now uint64) uint64
|
2020-06-08 23:54:10 +02:00
|
|
|
setTimeOffset(ntp uint64, rtp uint32)
|
2020-05-26 17:44:21 +02:00
|
|
|
}
|