Skip to content

Commit

Permalink
Update README examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed Jun 6, 2024
1 parent ead3efb commit a9c8d22
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ if err != nil {
defer context.Close()

sender, err := roc.OpenSender(roc.SenderConfig{
FrameSampleRate: 44100,
FrameChannels: roc.ChannelSetStereo,
FrameEncoding: roc.FrameEncodingPcmFloat,
FecEncoding: roc.FecEncodingRs8m,
ClockSource: roc.ClockInternal,
FrameEncoding: roc.MediaEncoding{
Rate: 44100,
Format: roc.FormatPcmFloat32,
Channels: roc.ChannelLayoutStereo,
},
FecEncoding: roc.FecEncodingRs8m,
ClockSource: roc.ClockSourceInternal,
})
if err != nil {
panic(err)
Expand All @@ -65,6 +67,11 @@ 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)
Expand All @@ -75,6 +82,11 @@ if err != nil {
panic(err)
}

err = sender.Connect(roc.SlotDefault, roc.InterfaceAudioControl, controlEndpoint)
if err != nil {
panic(err)
}

for {
samples := make([]float32, 320)

Expand All @@ -101,10 +113,12 @@ if err != nil {
defer context.Close()

receiver, err := roc.OpenReceiver(roc.ReceiverConfig{
FrameSampleRate: 44100,
FrameChannels: roc.ChannelSetStereo,
FrameEncoding: roc.FrameEncodingPcmFloat,
ClockSource: roc.ClockInternal,
FrameEncoding: roc.MediaEncoding{
Rate: 44100,
Format: roc.FormatPcmFloat32,
Channels: roc.ChannelLayoutStereo,
},
ClockSource: roc.ClockSourceInternal,
})
if err != nil {
panic(err)
Expand All @@ -121,6 +135,11 @@ 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)
Expand All @@ -131,6 +150,11 @@ if err != nil {
panic(err)
}

err = receiver.Bind(roc.SlotDefault, roc.InterfaceAudioControl, controlEndpoint)
if err != nil {
panic(err)
}

for {
samples := make([]float32, 320)

Expand Down

0 comments on commit a9c8d22

Please sign in to comment.