Update machinery/src/capture/gortsplib.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Cédric Verstraeten
2025-07-13 13:35:00 +02:00
committed by GitHub
parent 086080a431
commit 3a0f8de400

View File

@@ -1044,11 +1044,8 @@ func (d *Decoder) Close() {
}
func (d *Decoder) decode(nalu []byte) (image.YCbCr, error) {
// Create a new slice with start code + nalu data
// This avoids the cgo pointer issue by creating a fresh slice each time
naluWithStartCode := make([]byte, len(nalu)+4)
copy(naluWithStartCode[:4], []byte{0x00, 0x00, 0x00, 0x01})
copy(naluWithStartCode[4:], nalu)
// Prepend the NALU start code using a helper function
naluWithStartCode := prependNALUStartCode(nalu)
// send NALU to decoder
var avPacket C.AVPacket