Files
gortsplib/track_aac_test.go
2022-06-23 13:13:36 +02:00

60 lines
1.2 KiB
Go

package gortsplib
import (
"testing"
psdp "github.com/pion/sdp/v3"
"github.com/stretchr/testify/require"
)
func TestTrackAACClone(t *testing.T) {
track := &TrackAAC{
PayloadType: 96,
Type: 2,
SampleRate: 48000,
ChannelCount: 2,
AOTSpecificConfig: []byte{0x01, 0x02},
SizeLength: 13,
IndexLength: 3,
IndexDeltaLength: 3,
}
clone := track.clone()
require.NotSame(t, track, clone)
require.Equal(t, track, clone)
}
func TestTrackAACMediaDescription(t *testing.T) {
track := &TrackAAC{
PayloadType: 96,
Type: 2,
SampleRate: 48000,
ChannelCount: 2,
SizeLength: 13,
IndexLength: 3,
IndexDeltaLength: 3,
}
require.Equal(t, &psdp.MediaDescription{
MediaName: psdp.MediaName{
Media: "audio",
Protos: []string{"RTP", "AVP"},
Formats: []string{"96"},
},
Attributes: []psdp.Attribute{
{
Key: "rtpmap",
Value: "96 mpeg4-generic/48000/2",
},
{
Key: "fmtp",
Value: "96 profile-level-id=1; mode=AAC-hbr; sizelength=13; indexlength=3; indexdeltalength=3; config=1190",
},
{
Key: "control",
Value: "",
},
},
}, track.MediaDescription())
}