Files
gortsplib/pkg/format/lpcm_test.go
Alessandro Ros a1396206b5 convert Tracks into Medias and Formats (#155)
* split tracks from medias

* move tracks into dedicated package

* move media into dedicated package

* edit Medias.Marshal() in order to return SDP

* add medias.Find() and simplify examples

* improve coverage

* fix rebase errors

* replace TrackIDs with MediaIDs

* implement media-specific and track-specific callbacks for reading RTCP and RTP packets

* rename publish into record, read into play

* add v2 tag

* rename tracks into formats
2022-12-11 22:03:22 +01:00

46 lines
858 B
Go

package format
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestLPCMAttributes(t *testing.T) {
format := &LPCM{
PayloadTyp: 96,
BitDepth: 24,
SampleRate: 44100,
ChannelCount: 2,
}
require.Equal(t, "LPCM", format.String())
require.Equal(t, 44100, format.ClockRate())
require.Equal(t, uint8(96), format.PayloadType())
}
func TestTracLPCMClone(t *testing.T) {
format := &LPCM{
PayloadTyp: 96,
BitDepth: 16,
SampleRate: 48000,
ChannelCount: 2,
}
clone := format.Clone()
require.NotSame(t, format, clone)
require.Equal(t, format, clone)
}
func TestLPCMMediaDescription(t *testing.T) {
format := &LPCM{
PayloadTyp: 96,
BitDepth: 24,
SampleRate: 96000,
ChannelCount: 2,
}
rtpmap, fmtp := format.Marshal()
require.Equal(t, "L24/96000/2", rtpmap)
require.Equal(t, "", fmtp)
}