You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi:
I added audio support to convert AAC to opus. Welcome to test
add import package
"github.com/Glimesh/go-fdkaac/fdkaac"
opus "gopkg.in/hraban/opus.v2"
please run in bash:
apt install -y pkg-config build-essential libopusfile-dev libfdk-aac-dev libavutil-dev libavcodec-dev libswscale-dev
hi:
I added audio support to convert AAC to opus. Welcome to test
add import package
"github.com/Glimesh/go-fdkaac/fdkaac"
opus "gopkg.in/hraban/opus.v2"
please run in bash:
apt install -y pkg-config build-essential libopusfile-dev libfdk-aac-dev libavutil-dev libavcodec-dev libswscale-dev
source code:
type Handler struct {
rtmp.DefaultHandler
peerConnection *webrtc.PeerConnection
videoTrack, audioTrack *webrtc.TrackLocalStaticSample
audioDecoder *fdkaac.AacDecoder
audioEncoder *opus.Encoder
audioBuffer []byte
audioClockRate uint32
}
func (h *Handler) SetOpusCtl() {
h.audioEncoder.SetMaxBandwidth(opus.Bandwidth(2))
h.audioEncoder.SetComplexity(9)
h.audioEncoder.SetBitrateToAuto()
h.audioEncoder.SetInBandFEC(true)
}
func (h *Handler) initAudio(clockRate uint32) error {
// h.audioSequencer = rtp.NewFixedSequencer(0) // ftl client says this should be changed to a random value
// h.audioPacketizer = rtp.NewPacketizer(FTL_MTU, FTL_AUDIO_PT, uint32(h.channelID), &codecs.OpusPayloader{}, h.audioSequencer, clockRate)
// if h.audioEncoder != nil && h.audioDecoder != nil {
// return nil
// }
encoder, err := opus.NewEncoder(48000, 2, opus.AppAudio)
if err != nil {
println(err.Error())
return err
}
h.audioEncoder = encoder
h.SetOpusCtl()
// h.audioEncoder, err = opus.NewEncoder(int(clockRate), 32000, 2) //
// h.audioEncoder, err = opus.NewEncoder(int(clockRate), 2, opus.AppVoIP)
// if err != nil {
// return err
// }
h.audioDecoder = fdkaac.NewAacDecoder()
}
func (h *Handler) OnAudio(timestamp uint32, payload io.Reader) error {
// Convert AAC to opus
var audio flvtag.AudioData
if err := flvtag.DecodeAudioData(payload, &audio); err != nil {
return err
}
}
The text was updated successfully, but these errors were encountered: