diff mbox series

[FFmpeg-devel] avformat/mux: Remove unnecessary unreferencing of AVPacket

Message ID 20200509201810.10532-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 06fdc823371d295a6f29993e5c2e9ed7df3610d2
Headers show
Series [FFmpeg-devel] avformat/mux: Remove unnecessary unreferencing of AVPacket | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 9, 2020, 8:18 p.m. UTC
Since commit c5324d92c5f206dcdc2cf93ae237eaa7c1ad0a40 all custom
interleave_packet() functions always return clean packets (even on
error), so that unreferencing manually can be removed.

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

Comments

Andreas Rheinhardt May 22, 2020, 1:36 a.m. UTC | #1
Andreas Rheinhardt:
> Since commit c5324d92c5f206dcdc2cf93ae237eaa7c1ad0a40 all custom
> interleave_packet() functions always return clean packets (even on
> error), so that unreferencing manually can be removed.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/mux.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index f2de73af9b..c17686c0a6 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -1075,10 +1075,7 @@ int ff_interleaved_peek(AVFormatContext *s, int stream,
>  static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
>  {
>      if (s->oformat->interleave_packet) {
> -        int ret = s->oformat->interleave_packet(s, out, in, flush);
> -        if (in)
> -            av_packet_unref(in);
> -        return ret;
> +        return s->oformat->interleave_packet(s, out, in, flush);
>      } else
>          return ff_interleave_packet_per_dts(s, out, in, flush);
>  }
> 
Will apply this tomorrow unless there are objections.

- Andreas
Andreas Rheinhardt May 23, 2020, 4:52 a.m. UTC | #2
Andreas Rheinhardt:
> Andreas Rheinhardt:
>> Since commit c5324d92c5f206dcdc2cf93ae237eaa7c1ad0a40 all custom
>> interleave_packet() functions always return clean packets (even on
>> error), so that unreferencing manually can be removed.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>>  libavformat/mux.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/libavformat/mux.c b/libavformat/mux.c
>> index f2de73af9b..c17686c0a6 100644
>> --- a/libavformat/mux.c
>> +++ b/libavformat/mux.c
>> @@ -1075,10 +1075,7 @@ int ff_interleaved_peek(AVFormatContext *s, int stream,
>>  static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
>>  {
>>      if (s->oformat->interleave_packet) {
>> -        int ret = s->oformat->interleave_packet(s, out, in, flush);
>> -        if (in)
>> -            av_packet_unref(in);
>> -        return ret;
>> +        return s->oformat->interleave_packet(s, out, in, flush);
>>      } else
>>          return ff_interleave_packet_per_dts(s, out, in, flush);
>>  }
>>
> Will apply this tomorrow unless there are objections.
> 
> - Andreas
> 
Applied.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/mux.c b/libavformat/mux.c
index f2de73af9b..c17686c0a6 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1075,10 +1075,7 @@  int ff_interleaved_peek(AVFormatContext *s, int stream,
 static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
 {
     if (s->oformat->interleave_packet) {
-        int ret = s->oformat->interleave_packet(s, out, in, flush);
-        if (in)
-            av_packet_unref(in);
-        return ret;
+        return s->oformat->interleave_packet(s, out, in, flush);
     } else
         return ff_interleave_packet_per_dts(s, out, in, flush);
 }