|
|
|
@ -10,7 +10,6 @@ package hevc
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
|
|
|
|
|
"github.com/q191201771/naza/pkg/nazaerrors"
|
|
|
|
|
|
|
|
|
|
"github.com/q191201771/lal/pkg/base"
|
|
|
|
@ -252,13 +251,15 @@ func ParseVpsSpsPpsFromSeqHeaderWithoutMalloc(payload []byte) (vps, sps, pps []b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vps, sps, pps, err = parseVpsSpsPpsFromRecord(payload)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if err != nil && StrategyTryAnnexbWhenParseVspFromSeqHeaderFailed {
|
|
|
|
|
//Log.Warnf("parse vps sps pps from seq header failed. try parse from annexb. payload=%s, err=%+v", hex.Dump(payload), err)
|
|
|
|
|
vps, sps, pps, err = parseVpsSpsPpsAnnexbFromRecord(payload)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(chef): 函数中 vps 等变量指向的为新申请的内存块,与调用它的函数 ParseVpsSpsPpsFromSeqHeaderWithoutMalloc 语义不相符 202405
|
|
|
|
|
func parseVpsSpsPpsAnnexbFromRecord(payload []byte) (vps, sps, pps []byte, err error) {
|
|
|
|
|
for i := 0; i < len(payload)-4; {
|
|
|
|
|
start := bytes.Index(payload[i:], NaluStartCode4)
|
|
|
|
|