bitrate

package
v0.30.8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 2 Imported by: 6

Documentation

Overview

Package bitrate 平滑计算比特率(码率)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitrate

type Bitrate interface {
	// Add
	//
	// @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