
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
github.com/roc-streaming/roc-go
This library provides Go (golang) bindings for Roc Toolkit, a toolkit for real-time audio streaming over the network.
Key features of Roc Toolkit:
Compatible Roc Toolkit senders and receivers include:
Documentation for the bindings is available on pkg.go.dev.
Documentation for the underlying C API can be found here.
import (
"github.com/roc-streaming/roc-go/roc"
)
context, err := roc.OpenContext(roc.ContextConfig{})
if err != nil {
panic(err)
}
defer context.Close()
sender, err := roc.OpenSender(roc.SenderConfig{
FrameEncoding: roc.MediaEncoding{
Rate: 44100,
Format: roc.FormatPcmFloat32,
Channels: roc.ChannelLayoutStereo,
},
PacketEncoding: roc.PacketEncodingAvpL16Stereo,
FecEncoding: roc.FecEncodingRs8m,
ClockSource: roc.ClockSourceInternal,
})
if err != nil {
panic(err)
}
defer sender.Close()
sourceEndpoint, err := roc.ParseEndpoint("rtp+rs8m://192.168.0.1:10001")
if err != nil {
panic(err)
}
repairEndpoint, err := roc.ParseEndpoint("rs8m://192.168.0.1:10002")
if err != nil {
panic(err)
}
controlEndpoint, err := roc.ParseEndpoint("rtcp://192.168.0.1:10003")
if err != nil {
panic(err)
}
err = sender.Connect(roc.SlotDefault, roc.InterfaceAudioSource, sourceEndpoint)
if err != nil {
panic(err)
}
err = sender.Connect(roc.SlotDefault, roc.InterfaceAudioRepair, repairEndpoint)
if err != nil {
panic(err)
}
err = sender.Connect(roc.SlotDefault, roc.InterfaceAudioControl, controlEndpoint)
if err != nil {
panic(err)
}
for {
samples := make([]float32, 320)
/* fill samples */
err = sender.WriteFloats(samples)
if err != nil {
panic(err)
}
}
import (
"github.com/roc-streaming/roc-go/roc"
)
context, err := roc.OpenContext(roc.ContextConfig{})
if err != nil {
panic(err)
}
defer context.Close()
receiver, err := roc.OpenReceiver(roc.ReceiverConfig{
FrameEncoding: roc.MediaEncoding{
Rate: 44100,
Format: roc.FormatPcmFloat32,
Channels: roc.ChannelLayoutStereo,
},
ClockSource: roc.ClockSourceInternal,
})
if err != nil {
panic(err)
}
defer receiver.Close()
sourceEndpoint, err := roc.ParseEndpoint("rtp+rs8m://0.0.0.0:10001")
if err != nil {
panic(err)
}
repairEndpoint, err := roc.ParseEndpoint("rs8m://0.0.0.0:10002")
if err != nil {
panic(err)
}
controlEndpoint, err := roc.ParseEndpoint("rtcp://0.0.0.0:10003")
if err != nil {
panic(err)
}
err = receiver.Bind(roc.SlotDefault, roc.InterfaceAudioSource, sourceEndpoint)
if err != nil {
panic(err)
}
err = receiver.Bind(roc.SlotDefault, roc.InterfaceAudioRepair, repairEndpoint)
if err != nil {
panic(err)
}
err = receiver.Bind(roc.SlotDefault, roc.InterfaceAudioControl, controlEndpoint)
if err != nil {
panic(err)
}
for {
samples := make([]float32, 320)
err = receiver.ReadFloats(samples)
if err != nil {
panic(err)
}
/* process samples */
}
Go bindings and the C library both use semantic versioning.
Bindings are compatible with the C library when:
Patch versions of bindings and C library are independent.
For example, version 1.2.3 of the bindings would be compatible with 1.2.x and 1.3.x, but not with 1.1.x (minor version is lower) or 2.x.x (major version is different).
You will need to have Roc Toolkit library and headers installed system-wide. Refer to official build instructions on how to install it.
After installing libroc, you can install bindings using regular go get
:
go get github.com/roc-streaming/roc-go/roc
Install development dependencies:
go install golang.org/x/tools/cmd/stringer@latest
Run all checks:
make
Run only specific checks:
make gen|build|lint|test|testall
Update modules:
make tidy
Format code:
make fmt
To release a new version:
Create git tag
./tag.py --push <remote> <version>
e.g.
./tag.py --push origin 1.2.3
Or use tag.py without --push to only create a tag locally, and then push it manually.
Wait until "Release" CI job completes and creates GitHub release draft.
Edit GitHub release created by CI and publish it.
See here.
Bindings are licensed under MIT.
For details on Roc Toolkit licensing, see here.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.