mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +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:
49
pkg/format/g711_test.go
Normal file
49
pkg/format/g711_test.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package format
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestG711Attributes(t *testing.T) {
|
||||
format := &G711{}
|
||||
require.Equal(t, "G711", format.String())
|
||||
require.Equal(t, 8000, format.ClockRate())
|
||||
require.Equal(t, uint8(8), format.PayloadType())
|
||||
|
||||
format = &G711{
|
||||
MULaw: true,
|
||||
}
|
||||
require.Equal(t, "G711", format.String())
|
||||
require.Equal(t, 8000, format.ClockRate())
|
||||
require.Equal(t, uint8(0), format.PayloadType())
|
||||
}
|
||||
|
||||
func TestG711Clone(t *testing.T) {
|
||||
format := &G711{}
|
||||
|
||||
clone := format.Clone()
|
||||
require.NotSame(t, format, clone)
|
||||
require.Equal(t, format, clone)
|
||||
}
|
||||
|
||||
func TestG711MediaDescription(t *testing.T) {
|
||||
t.Run("pcma", func(t *testing.T) {
|
||||
format := &G711{}
|
||||
|
||||
rtpmap, fmtp := format.Marshal()
|
||||
require.Equal(t, "PCMA/8000", rtpmap)
|
||||
require.Equal(t, "", fmtp)
|
||||
})
|
||||
|
||||
t.Run("pcmu", func(t *testing.T) {
|
||||
format := &G711{
|
||||
MULaw: true,
|
||||
}
|
||||
|
||||
rtpmap, fmtp := format.Marshal()
|
||||
require.Equal(t, "PCMU/8000", rtpmap)
|
||||
require.Equal(t, "", fmtp)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user