mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
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
This commit is contained in:
45
pkg/format/vorbis_test.go
Normal file
45
pkg/format/vorbis_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package format
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestVorbisAttributes(t *testing.T) {
|
||||
format := &Vorbis{
|
||||
PayloadTyp: 96,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Configuration: []byte{0x01, 0x02, 0x03, 0x04},
|
||||
}
|
||||
require.Equal(t, "Vorbis", format.String())
|
||||
require.Equal(t, 48000, format.ClockRate())
|
||||
require.Equal(t, uint8(96), format.PayloadType())
|
||||
}
|
||||
|
||||
func TestTracVorbisClone(t *testing.T) {
|
||||
format := &Vorbis{
|
||||
PayloadTyp: 96,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Configuration: []byte{0x01, 0x02, 0x03, 0x04},
|
||||
}
|
||||
|
||||
clone := format.Clone()
|
||||
require.NotSame(t, format, clone)
|
||||
require.Equal(t, format, clone)
|
||||
}
|
||||
|
||||
func TestVorbisMediaDescription(t *testing.T) {
|
||||
format := &Vorbis{
|
||||
PayloadTyp: 96,
|
||||
SampleRate: 48000,
|
||||
ChannelCount: 2,
|
||||
Configuration: []byte{0x01, 0x02, 0x03, 0x04},
|
||||
}
|
||||
|
||||
rtpmap, fmtp := format.Marshal()
|
||||
require.Equal(t, "VORBIS/48000/2", rtpmap)
|
||||
require.Equal(t, "configuration=AQIDBA==", fmtp)
|
||||
}
|
Reference in New Issue
Block a user