diff mbox series

[FFmpeg-devel,01/21] avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer

Message ID 20200322034756.29907-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,01/21] avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt March 22, 2020, 3:47 a.m. UTC
Also simply return 0 in case a packet has been successfully read.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/nsvdec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Anton Khirnov March 26, 2020, 9:37 a.m. UTC | #1
Quoting Andreas Rheinhardt (2020-03-22 04:47:36)
> Also simply return 0 in case a packet has been successfully read.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/nsvdec.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Looks ok.
Andreas Rheinhardt March 26, 2020, 8:12 p.m. UTC | #2
Anton Khirnov:
> Quoting Andreas Rheinhardt (2020-03-22 04:47:36)
>> Also simply return 0 in case a packet has been successfully read.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>>  libavformat/nsvdec.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> Looks ok.
> 
Thanks, applied.

- Andreas
diff mbox series

Patch

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;
         }
     }