avcodec/amfnec: allocate packets using av_new_packet()

This ensures they will be reference counted, as required by the AVCodec.receive_packet()
API.

Should fix ticket #8386.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fdf46b4a6b)
This commit is contained in:
James Almer 2019-11-19 19:42:48 -03:00
parent 44fe41a1ca
commit 57365f67a0
1 changed files with 1 additions and 1 deletions

View File

@ -438,7 +438,7 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buff
int64_t timestamp = AV_NOPTS_VALUE;
int64_t size = buffer->pVtbl->GetSize(buffer);
if ((ret = ff_alloc_packet2(avctx, pkt, size, 0)) < 0) {
if ((ret = av_new_packet(pkt, size)) < 0) {
return ret;
}
memcpy(pkt->data, buffer->pVtbl->GetNative(buffer), size);