From: Andreas Rheinhardt Date: Sat, 21 Mar 2020 07:57:19 +0000 (+0100) Subject: avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9a96677023f77733d4de9e45a5d942e83d6bb6dc;hp=ba36a077342c01faa3f3deb841e8cdcc1379ea3d;p=ffmpeg avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer Also simply return 0 in case a packet has been successfully read. Reviewed-by: Anton Khirnov Signed-off-by: Andreas Rheinhardt --- diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index b5d93137780..eb26b294508 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -662,10 +662,8 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) /* now pick one of the plates */ for (i = 0; i < 2; i++) { if (nsv->ahead[i].data) { - /* avoid the cost of new_packet + memcpy(->data) */ - memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); - nsv->ahead[i].data = NULL; /* we ate that one */ - return pkt->size; + av_packet_move_ref(pkt, &nsv->ahead[i]); + return 0; } }