Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
Broadcaster is a specialized video broadcaster.
func NewBroadcaster ¶
func NewBroadcaster(source Reader, config *BroadcasterConfig) *Broadcaster
NewBroadcaster creates a new broadcaster. Source is expected to drop chunks when any of the readers is slower than the source.
func (*Broadcaster) NewReader ¶
func (broadcaster *Broadcaster) NewReader(copyChunk bool) Reader
NewReader creates a new reader. Each reader will retrieve the same data from the source. copyFn is used to copy the data from the source to individual readers. Broadcaster uses a small ring buffer, this means that slow readers might miss some data if they're really late and the data is no longer in the ring buffer.
func (*Broadcaster) ReplaceSource ¶
func (broadcaster *Broadcaster) ReplaceSource(source Reader) error
ReplaceSource replaces the underlying source. This operation is thread safe.
func (*Broadcaster) Source ¶
func (broadcaster *Broadcaster) Source() Reader
Source retrieves the underlying source. This operation is thread safe.
type BroadcasterConfig ¶
type BroadcasterConfig struct {
Core *io.BroadcasterConfig
}
type Reader ¶
type Reader interface { // Read reads data from the source. The caller is responsible to release the memory that's associated // with data by calling the given release function. When err is not nil, the caller MUST NOT call release // as data is going to be nil (no memory was given). Otherwise, the caller SHOULD call release after // using the data. The caller is NOT REQUIRED to call release, as this is only a part of memory management // optimization. If release is not called, the source is forced to allocate a new memory, which also means // there will be new allocations during streaming, and old unused memory will become garbage. As a consequence, // these garbage will put a lot of pressure to the garbage collector and makes it to run more often and finish // slower as the heap memory usage increases and more garbage to collect. Read() (chunk wave.Audio, release func(), err error) }
type ReaderFunc ¶
type TransformFunc ¶
TransformFunc produces a new Reader that will produces a transformed audio
func DetectChanges ¶
func DetectChanges(interval time.Duration, onChange func(prop.Media)) TransformFunc
DetectChanges will detect chunk and audio property changes. For audio property detection, since it's time related, interval will be used to determine the sample rate.
func Merge ¶
func Merge(transforms ...TransformFunc) TransformFunc
Merge merges transforms and produces a new TransformFunc that will execute transforms in order
func NewBuffer ¶
func NewBuffer(nSamples int) TransformFunc
NewBuffer creates audio transform to buffer signal to have exact nSample samples.
func NewChannelMixer ¶
func NewChannelMixer(channels int, mixer mixer.ChannelMixer) TransformFunc
NewChannelMixer creates audio transform to mix audio channels.