]> git.sesse.net Git - ffmpeg/commitdiff
avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 21 Mar 2020 07:57:19 +0000 (08:57 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 26 Mar 2020 19:06:15 +0000 (20:06 +0100)
Also simply return 0 in case a packet has been successfully read.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/nsvdec.c

index b5d9313778087d682712beab982c2b2cbf212c57..eb26b294508c485a0f4841e673a513a85cc38901 100644 (file)
@@ -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;
         }
     }