Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to roc-toolkit 0.4.0 #124

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -y install g++ pkg-config scons ragel gengetopt \
libuv1-dev libunwind-dev libspeexdsp-dev libsox-dev libpulse-dev \
libuv1-dev libunwind-dev libspeexdsp-dev libsox-dev libsndfile1-dev libpulse-dev \
libtool intltool autoconf automake make cmake meson

- name: Install Go
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:

- name: Install system dependencies
run: |
brew install scons ragel gengetopt libuv speexdsp sox cpputest
brew install scons ragel gengetopt libuv speexdsp sox libsndfile cpputest

- name: Install Go
uses: actions/setup-go@v5
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ sender, err := roc.OpenSender(roc.SenderConfig{
Format: roc.FormatPcmFloat32,
Channels: roc.ChannelLayoutStereo,
},
FecEncoding: roc.FecEncodingRs8m,
ClockSource: roc.ClockSourceInternal,
PacketEncoding: roc.PacketEncodingAvpL16Stereo,
FecEncoding: roc.FecEncodingRs8m,
ClockSource: roc.ClockSourceInternal,
})
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion roc/channel_layout.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions roc/clock_source.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions roc/clock_source_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions roc/clock_sync_backend.go

This file was deleted.

35 changes: 0 additions & 35 deletions roc/clock_sync_backend_string.go

This file was deleted.

48 changes: 0 additions & 48 deletions roc/clock_sync_profile.go

This file was deleted.

25 changes: 0 additions & 25 deletions roc/clock_sync_profile_string.go

This file was deleted.

11 changes: 3 additions & 8 deletions roc/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@ func makeContextConfig() ContextConfig {

func makeSenderConfig() SenderConfig {
return SenderConfig{
FrameEncoding: makeMediaEncoding(),
ClockSource: ClockSourceInternal,
FecEncoding: FecEncodingRs8m,
FrameEncoding: makeMediaEncoding(),
PacketEncoding: PacketEncodingAvpL16Stereo,
}
}

func makeReceiverConfig() ReceiverConfig {
return ReceiverConfig{
FrameEncoding: makeMediaEncoding(),
ClockSource: ClockSourceInternal,
ClockSyncBackend: ClockSyncBackendDisable,
FrameEncoding: makeMediaEncoding(),
}
}

func makeInterfaceConfig() InterfaceConfig {
return InterfaceConfig{
OutgoingAddress: "127.0.0.1",
MulticastGroup: "",
ReuseAddress: true,
}
}
Expand All @@ -36,6 +32,5 @@ func makeMediaEncoding() MediaEncoding {
Rate: 44100,
Format: FormatPcmFloat32,
Channels: ChannelLayoutStereo,
Tracks: 0,
}
}
43 changes: 23 additions & 20 deletions roc/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,34 @@ import (

// Shared context.
//
// Context contains memory pools and network worker threads, shared among objects attached
// to the context. It is allowed both to create a separate context for every object, or
// to create a single context shared between multiple objects.
// Context contains memory pools and network worker threads, shared among
// objects attached to the context. It is allowed both to create a separate
// context for every object, or to create a single context shared between
// multiple objects.
//
// # Life cycle
//
// A context is created using OpenContext() and destroyed using Context.Close().
//
// Objects can be attached and detached to an opened context at any moment from any
// thread. However, the user should ensure that the context is not closed until there
// are no objects attached to the context.
//
// The user is responsible for closing any opened context before exiting the program.
// Objects can be attached and detached to an opened context at any moment from
// any thread. However, the user should ensure that the context is not closed
// until there are no objects attached to the context.
//
// # Thread safety
//
// Can be used concurrently.
// Can be used concurrently
//
// # See also
//
// See also Sender, Receiver.
// See also Sender, Receiver
type Context struct {
mu sync.RWMutex
cPtr *C.roc_context
}

// Open a new context.
//
// Allocates and initializes a new context. May start some background threads.
// User is responsible to call Context.Close to free context resources.
// Overrides the provided Result pointer with the newly created context.
func OpenContext(config ContextConfig) (ctx *Context, err error) {
logWrite(LogDebug, "entering OpenContext(): config=%+v", config)
defer func() {
Expand Down Expand Up @@ -72,17 +71,18 @@ func OpenContext(config ContextConfig) (ctx *Context, err error) {

// Register custom encoding.
//
// Registers encoding with given encodingID. Registered encodings complement
// Registers Encoding with given EncodingId. Registered encodings complement
// built-in encodings defined by PacketEncoding enum. Whenever you need to
// specify packet encoding, you can use both built-in and registered encodings.
//
// On sender, you should register custom encoding and set to PacketEncoding field
// of SenderConfig, if you need to force specific encoding of packets, but
// On sender, you should register custom encoding and set to PacketEncoding
// field of SenderConfig, if you need to force specific encoding of packets, but
// built-in set of encodings is not enough.
//
// On receiver, you should register custom encoding with same id and specification,
// if you did so on sender, and you're not using any signaling protocol (like RTSP)
// that is capable of automatic exchange of encoding information.
// On receiver, you should register custom encoding with same id and
// specification, if you did so on sender, and you're not using any signaling
// protocol (like RTSP) that is capable of automatic exchange of encoding
// information.
//
// In case of RTP, encoding id is mapped directly to payload type field (PT).
func (c *Context) RegisterEncoding(encodingID int, encoding MediaEncoding) (err error) {
Expand Down Expand Up @@ -122,8 +122,11 @@ func (c *Context) RegisterEncoding(encodingID int, encoding MediaEncoding) (err
}

// Close the context.
// Stops any started background threads, deinitializes and deallocates the context.
// The user should ensure that nobody uses the context during and after this call.
//
// Stops any started background threads, deinitializes and deallocates the
// context. The user should ensure that nobody uses the context during and after
// this call.
//
// If this function fails, the context is kept opened.
func (c *Context) Close() (err error) {
logWrite(LogDebug, "entering Context.Close(): context=%p", c)
Expand Down
12 changes: 7 additions & 5 deletions roc/context_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading