support generic tracks with multiple formats (https://github.com/aler9/rtsp-simple-server/issues/1103)

This commit is contained in:
aler9
2022-10-28 19:10:54 +02:00
parent 394c2f0696
commit 6e6be34636
8 changed files with 243 additions and 157 deletions

View File

@@ -14,11 +14,11 @@ type TrackPCMU struct {
func newTrackPCMUFromMediaDescription(
control string,
rtpmapPart1 string) (*TrackPCMU, error,
clock string) (*TrackPCMU, error,
) {
tmp := strings.Split(rtpmapPart1, "/")
if len(tmp) >= 3 && tmp[2] != "1" {
return nil, fmt.Errorf("PCMU tracks must have only one channel")
tmp := strings.SplitN(clock, "/", 2)
if len(tmp) == 2 && tmp[1] != "1" {
return nil, fmt.Errorf("PCMU tracks can have only one channel")
}
return &TrackPCMU{