bitrate

package
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2021 License: MIT Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitrate

type Bitrate interface {
	// @param nowUnixMs: 变参,可选择从外部传入当前 unix 时间戳,单位毫秒
	Add(bytes int, nowUnixMs ...int64)

	Rate(nowUnixMs ...int64) float32
}

func New added in v0.7.0

func New(modOptions ...ModOption) Bitrate

type ModOption

type ModOption func(option *Option)

type Option

type Option struct {
	WindowMs int
	Unit     Unit
}

TODO chef: 考虑支持配置是否在内部使用锁

type Unit added in v0.7.0

type Unit uint8
const (
	UnitBitPerSec Unit = iota + 1
	UnitBytePerSec
	UnitKbitPerSec
	UnitKbytePerSec
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL