Browse Source

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

pull/1301/head
aler9 3 years ago
parent
commit
7ed0a873f5
  1. 4
      internal/core/api_test.go
  2. 5
      internal/core/source.go

4
internal/core/api_test.go

@ -231,7 +231,7 @@ func TestAPIPathsList(t *testing.T) { @@ -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) { @@ -291,7 +291,7 @@ func TestAPIPathsList(t *testing.T) {
Type: "rtspsSession",
},
SourceReady: true,
Tracks: []string{"H264", "MPEG4Audio"},
Tracks: []string{"H264", "MPEG4-audio"},
},
},
}, out)

5
internal/core/source.go

@ -2,7 +2,6 @@ package core @@ -2,7 +2,6 @@ package core
import (
"fmt"
"reflect"
"strings"
"github.com/aler9/gortsplib"
@ -20,9 +19,7 @@ type source interface { @@ -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
}

Loading…
Cancel
Save