use Track.String() instead of reflect for getting track names

This commit is contained in:
aler9 2022-11-28 11:16:31 +01:00
parent e605727c78
commit 7ed0a873f5
2 changed files with 3 additions and 6 deletions

View File

@ -231,7 +231,7 @@ func TestAPIPathsList(t *testing.T) {
Type: "rtspSession",
},
SourceReady: true,
Tracks: []string{"H264", "MPEG4Audio"},
Tracks: []string{"H264", "MPEG4-audio"},
BytesReceived: 16,
},
},
@ -291,7 +291,7 @@ func TestAPIPathsList(t *testing.T) {
Type: "rtspsSession",
},
SourceReady: true,
Tracks: []string{"H264", "MPEG4Audio"},
Tracks: []string{"H264", "MPEG4-audio"},
},
},
}, out)

View File

@ -2,7 +2,6 @@ package core
import (
"fmt"
"reflect"
"strings"
"github.com/aler9/gortsplib"
@ -20,9 +19,7 @@ type source interface {
func sourceTrackNames(tracks gortsplib.Tracks) []string {
ret := make([]string, len(tracks))
for i, t := range tracks {
n := reflect.TypeOf(t).Elem().Name()
n = n[len("Track"):]
ret[i] = n
ret[i] = t.String()
}
return ret
}