From 7ed0a873f57e851a1141452381b549648459c027 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Mon, 28 Nov 2022 11:16:31 +0100 Subject: [PATCH] use Track.String() instead of reflect for getting track names --- internal/core/api_test.go | 4 ++-- internal/core/source.go | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/core/api_test.go b/internal/core/api_test.go index f3f0fa2f..ab9c363a 100644 --- a/internal/core/api_test.go +++ b/internal/core/api_test.go @@ -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) diff --git a/internal/core/source.go b/internal/core/source.go index 3dc2e133..58752c4d 100644 --- a/internal/core/source.go +++ b/internal/core/source.go @@ -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 }