diff mbox

[FFmpeg-devel] ffmpeg: simplify refcounting packets for the muxing queue

Message ID 20180806003414.3436-1-jamrial@gmail.com
State Accepted
Commit b955a33314d4707f3c90c75d7c319d2020ec111a
Headers show

Commit Message

James Almer Aug. 6, 2018, 12:34 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 fftools/ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

James Almer Aug. 7, 2018, 9:45 p.m. UTC | #1
On 8/5/2018 9:34 PM, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  fftools/ffmpeg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 55faec8ede..2459374f08 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -724,11 +724,11 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
>              if (ret < 0)
>                  exit_program(1);
>          }
> -        ret = av_packet_ref(&tmp_pkt, pkt);
> +        ret = av_packet_make_refcounted(pkt);
>          if (ret < 0)
>              exit_program(1);
> +        av_packet_move_ref(&tmp_pkt, pkt);
>          av_fifo_generic_write(ost->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL);
> -        av_packet_unref(pkt);
>          return;
>      }

Pushed.
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 55faec8ede..2459374f08 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -724,11 +724,11 @@  static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
             if (ret < 0)
                 exit_program(1);
         }
-        ret = av_packet_ref(&tmp_pkt, pkt);
+        ret = av_packet_make_refcounted(pkt);
         if (ret < 0)
             exit_program(1);
+        av_packet_move_ref(&tmp_pkt, pkt);
         av_fifo_generic_write(ost->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL);
-        av_packet_unref(pkt);
         return;
     }