Documentation ¶
Index ¶
Constants ¶
View Source
const ( BitrateDuration = 2 * time.Second BitrateWindow = 100 * time.Millisecond )
Variables ¶
View Source
var ErrDataDroppedBySlowReader = errors.New("data dropped by slow reader")
Functions ¶
This section is empty.
Types ¶
type BitrateCalculator ¶
type BitrateCalculator struct {
// contains filtered or unexported fields
}
BitrateCalculator calculates bitrate over sliding window
func NewBitrateCalculator ¶
func NewBitrateCalculator(duration time.Duration, window time.Duration) *BitrateCalculator
type BufferedAmountGetter ¶
type BufferedAmountGetter interface {
BufferedAmount() uint64
}
type DataChannelWriter ¶
type DataChannelWriter[T BufferedAmountGetter] struct { // contains filtered or unexported fields }
func NewDataChannelWriter ¶
func NewDataChannelWriter[T BufferedAmountGetter](bufferGetter T, rawDC datachannel.ReadWriteCloserDeadliner, slowThreshold int) *DataChannelWriter[T]
NewDataChannelWriter creates a new DataChannelWriter by detaching the data channel, when writing to the datachanel times out, it will block and retry if the receiver's bitrate is above the slowThreshold or drop the data if it's below the threshold. If the slowThreshold is 0, it will never retry on write timeout.
func (*DataChannelWriter[T]) BufferedAmountGetter ¶
func (w *DataChannelWriter[T]) BufferedAmountGetter() T
func (*DataChannelWriter[T]) Close ¶
func (w *DataChannelWriter[T]) Close() error
Click to show internal directories.
Click to hide internal directories.