diff mbox series

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

Message ID 20200322034756.29907-2-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 return 0 after successfully reading a packet.

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

Comments

Anton Khirnov March 26, 2020, 9:40 a.m. UTC | #1
Quoting Andreas Rheinhardt (2020-03-22 04:47:37)
> Also return 0 after successfully reading a packet.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/yop.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

ok
Andreas Rheinhardt March 26, 2020, 8:12 p.m. UTC | #2
Anton Khirnov:
> Quoting Andreas Rheinhardt (2020-03-22 04:47:37)
>> Also return 0 after successfully reading a packet.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>>  libavformat/yop.c | 9 +++------
>>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> ok
> 
Thanks, applied.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/yop.c b/libavformat/yop.c
index f9ead026a2..0d8d9f2ff7 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -125,14 +125,11 @@  static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
     yop->video_packet.stream_index = 1;
 
     if (yop->video_packet.data) {
-        *pkt                   =  yop->video_packet;
-        yop->video_packet.data =  NULL;
-        yop->video_packet.buf  =  NULL;
-        yop->video_packet.size =  0;
+        av_packet_move_ref(pkt, &yop->video_packet);
         pkt->data[0]           =  yop->odd_frame;
         pkt->flags             |= AV_PKT_FLAG_KEY;
         yop->odd_frame         ^= 1;
-        return pkt->size;
+        return 0;
     }
     ret = av_new_packet(&yop->video_packet,
                         yop->frame_size - yop->audio_block_length);
@@ -166,7 +163,7 @@  static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
         av_shrink_packet(&yop->video_packet, yop->palette_size + ret);
 
     // Arbitrarily return the audio data first
-    return yop->audio_block_length;
+    return 0;
 
 err_out:
     av_packet_unref(&yop->video_packet);