mirror of
https://github.com/aler9/gortsplib
synced 2025-10-22 06:39:28 +08:00
do not store extradata into H264 tracks
This commit is contained in:
@@ -16,7 +16,6 @@ type TrackH264 struct {
|
||||
PayloadType uint8
|
||||
SPS []byte
|
||||
PPS []byte
|
||||
Extradata []byte
|
||||
|
||||
trackBase
|
||||
mutex sync.RWMutex
|
||||
@@ -78,18 +77,8 @@ func (t *TrackH264) fillParamsFromMediaDescription(md *psdp.MediaDescription) er
|
||||
return fmt.Errorf("invalid sprop-parameter-sets (%v)", v)
|
||||
}
|
||||
|
||||
var extradata []byte
|
||||
if len(tmp) > 2 {
|
||||
var err error
|
||||
extradata, err = base64.StdEncoding.DecodeString(tmp[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid sprop-parameter-sets (%v)", v)
|
||||
}
|
||||
}
|
||||
|
||||
t.SPS = sps
|
||||
t.PPS = pps
|
||||
t.Extradata = extradata
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -107,7 +96,6 @@ func (t *TrackH264) clone() Track {
|
||||
PayloadType: t.PayloadType,
|
||||
SPS: t.SPS,
|
||||
PPS: t.PPS,
|
||||
Extradata: t.Extradata,
|
||||
trackBase: t.trackBase,
|
||||
}
|
||||
}
|
||||
@@ -156,9 +144,6 @@ func (t *TrackH264) MediaDescription() *psdp.MediaDescription {
|
||||
if t.PPS != nil {
|
||||
tmp = append(tmp, base64.StdEncoding.EncodeToString(t.PPS))
|
||||
}
|
||||
if t.Extradata != nil {
|
||||
tmp = append(tmp, base64.StdEncoding.EncodeToString(t.Extradata))
|
||||
}
|
||||
fmtp += "; sprop-parameter-sets=" + strings.Join(tmp, ",")
|
||||
|
||||
if len(t.SPS) >= 4 {
|
||||
|
@@ -170,7 +170,6 @@ func TestTrackH264Params(t *testing.T) {
|
||||
PayloadType: 96,
|
||||
SPS: []byte{0x01, 0x02},
|
||||
PPS: []byte{0x03, 0x04},
|
||||
Extradata: []byte{0x05, 0x06},
|
||||
}
|
||||
require.Equal(t, "", track.GetControl())
|
||||
require.Equal(t, []byte{0x01, 0x02}, track.SafeSPS())
|
||||
@@ -187,7 +186,6 @@ func TestTrackH264Clone(t *testing.T) {
|
||||
PayloadType: 96,
|
||||
SPS: []byte{0x01, 0x02},
|
||||
PPS: []byte{0x03, 0x04},
|
||||
Extradata: []byte{0x05, 0x06},
|
||||
}
|
||||
|
||||
clone := track.clone()
|
||||
@@ -206,9 +204,6 @@ func TestTrackH264MediaDescription(t *testing.T) {
|
||||
PPS: []byte{
|
||||
0x68, 0xee, 0x3c, 0x80,
|
||||
},
|
||||
Extradata: []byte{
|
||||
0x01, 0x02,
|
||||
},
|
||||
}
|
||||
|
||||
require.Equal(t, &psdp.MediaDescription{
|
||||
@@ -225,7 +220,7 @@ func TestTrackH264MediaDescription(t *testing.T) {
|
||||
{
|
||||
Key: "fmtp",
|
||||
Value: "96 packetization-mode=1; " +
|
||||
"sprop-parameter-sets=Z2QADKw7ULBLQgAAAwACAAADAD0I,aO48gA==,AQI=; profile-level-id=64000C",
|
||||
"sprop-parameter-sets=Z2QADKw7ULBLQgAAAwACAAADAD0I,aO48gA==; profile-level-id=64000C",
|
||||
},
|
||||
{
|
||||
Key: "control",
|
||||
|
@@ -335,9 +335,6 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
||||
PPS: []byte{
|
||||
0x68, 0xfa, 0x8f, 0x2c,
|
||||
},
|
||||
Extradata: []byte{
|
||||
0x68, 0xfa, 0x8f, 0x2c,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user