|
|
@ -12,7 +12,7 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
decoders := map[pnyx.PeerID]*opus.Decoder{}
|
|
|
|
decoders := map[pnyx.PeerID]*opus.Decoder{}
|
|
|
|
encoder, err := opus.NewEncoder(44100, 1, opus.AppVoIP)
|
|
|
|
encoder, err := opus.NewEncoder(48000, 1, opus.AppVoIP)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -69,8 +69,8 @@ func main() {
|
|
|
|
inDeviceConfig.Capture.Format = malgo.FormatS16
|
|
|
|
inDeviceConfig.Capture.Format = malgo.FormatS16
|
|
|
|
inDeviceConfig.Capture.Channels = 1
|
|
|
|
inDeviceConfig.Capture.Channels = 1
|
|
|
|
inDeviceConfig.Capture.DeviceID = capture_device.ID.Pointer()
|
|
|
|
inDeviceConfig.Capture.DeviceID = capture_device.ID.Pointer()
|
|
|
|
inDeviceConfig.SampleRate = 44100
|
|
|
|
inDeviceConfig.SampleRate = 48000
|
|
|
|
inDeviceConfig.PeriodSizeInFrames = 882
|
|
|
|
inDeviceConfig.PeriodSizeInFrames = 960
|
|
|
|
inDeviceConfig.Alsa.NoMMap = 1
|
|
|
|
inDeviceConfig.Alsa.NoMMap = 1
|
|
|
|
inDeviceConfig.Capture.ShareMode = malgo.Shared
|
|
|
|
inDeviceConfig.Capture.ShareMode = malgo.Shared
|
|
|
|
|
|
|
|
|
|
|
@ -78,8 +78,8 @@ func main() {
|
|
|
|
outDeviceConfig.Playback.Format = malgo.FormatS16
|
|
|
|
outDeviceConfig.Playback.Format = malgo.FormatS16
|
|
|
|
outDeviceConfig.Playback.Channels = 1
|
|
|
|
outDeviceConfig.Playback.Channels = 1
|
|
|
|
outDeviceConfig.Playback.DeviceID = playback_device.ID.Pointer()
|
|
|
|
outDeviceConfig.Playback.DeviceID = playback_device.ID.Pointer()
|
|
|
|
outDeviceConfig.SampleRate = 44100
|
|
|
|
outDeviceConfig.SampleRate = 48000
|
|
|
|
outDeviceConfig.PeriodSizeInFrames = 882
|
|
|
|
outDeviceConfig.PeriodSizeInFrames = 960
|
|
|
|
outDeviceConfig.Alsa.NoMMap = 1
|
|
|
|
outDeviceConfig.Alsa.NoMMap = 1
|
|
|
|
outDeviceConfig.Playback.ShareMode = malgo.Shared
|
|
|
|
outDeviceConfig.Playback.ShareMode = malgo.Shared
|
|
|
|
|
|
|
|
|
|
|
@ -181,7 +181,7 @@ func main() {
|
|
|
|
if packet.Channel == pnyx.ChannelID(1) {
|
|
|
|
if packet.Channel == pnyx.ChannelID(1) {
|
|
|
|
decoder, exists := decoders[peer]
|
|
|
|
decoder, exists := decoders[peer]
|
|
|
|
if exists == false {
|
|
|
|
if exists == false {
|
|
|
|
decoder, err = opus.NewDecoder(44100, 1)
|
|
|
|
decoder, err = opus.NewDecoder(48000, 1)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|