ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@gmail.com> | 
Sat Mar 21 08:57:19 2020 +0100| [9a96677023f77733d4de9e45a5d942e83d6bb6dc] | 
committer: Andreas Rheinhardt

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 <an...@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a96677023f77733d4de9e45a5d942e83d6bb6dc
---

 libavformat/nsvdec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index b5d9313778..eb26b29450 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;
         }
     }
 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to