test error

This commit is contained in:
Andrey Semochkin 2021-04-10 10:46:45 +03:00
parent b0aae43f10
commit 9f799014f4
2 changed files with 7 additions and 1 deletions

View File

@ -227,6 +227,9 @@ func SplitNALUs(b []byte) (nalus [][]byte, typ int) {
_b := b[4:]
nalus := [][]byte{}
for {
if _val4 > uint32(len(_b)) {
break
}
nalus = append(nalus, _b[:_val4])
_b = _b[_val4:]
if len(_b) < 4 {

View File

@ -555,6 +555,9 @@ func (client *RTSPClient) RTPDemuxer(payloadRAW *[]byte) ([]*av.Packet, bool) {
client.BufferRtpPacket.Reset()
}
nalRaw, _ := h264parser.SplitNALUs(content[offset:end])
if len(nalRaw) == 0 || len(nalRaw[0]) == 0 {
return nil, false
}
var retmap []*av.Packet
for _, nal := range nalRaw {
if client.videoCodec == av.H265 {
@ -637,7 +640,7 @@ func (client *RTSPClient) RTPDemuxer(payloadRAW *[]byte) ([]*av.Packet, bool) {
if isEnd {
client.fuStarted = false
naluTypef := client.BufferRtpPacket.Bytes()[0] & 0x1f
if naluTypef == 7 {
if naluTypef == 7 || naluTypef == 9 {
bufered, _ := h264parser.SplitNALUs(append([]byte{0, 0, 0, 1}, client.BufferRtpPacket.Bytes()...))
for _, v := range bufered {
naluTypefs := v[0] & 0x1f