various performance improvements (#561)

This commit is contained in:
Alessandro Ros
2024-05-05 11:20:22 +02:00
committed by GitHub
parent 8c26f5f00a
commit 9da49cdf63
5 changed files with 26 additions and 6 deletions

View File

@@ -191,7 +191,7 @@ outer:
return nil, fmt.Errorf("JPEG type %d is not supported", sof.Type)
}
if data == nil {
if len(data) == 0 {
return nil, fmt.Errorf("image data not found")
}
@@ -211,7 +211,7 @@ outer:
offset := 0
var ret []*rtp.Packet
for len(data) > 0 {
for {
var buf []byte
jh.FragmentOffset = uint32(offset)
@@ -266,6 +266,10 @@ outer:
Payload: buf,
})
e.sequenceNumber++
if len(data) == 0 {
break
}
}
return ret, nil