diff mbox series

[FFmpeg-devel,v2] avformat/smoothstreaming: Don't write trailer of subcontext

Message ID 20200623043309.11990-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 76a413d961f793e9c9cec482b06df615a0dc694d
Headers show
Series [FFmpeg-devel,v2] avformat/smoothstreaming: Don't write trailer of subcontext | expand

Checks

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

Commit Message

Andreas Rheinhardt June 23, 2020, 4:33 a.m. UTC
Nothing written in avformat_write_trailer() for the submuxers will be
output anyway because the AVIOContexts used for actual output have been
closed before the call. Writing the trailer of the subcontext has probably
only been done in order to free the memory allocated by the submuxer.
And this job has been taken over by the deinit functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
Resending because 82bf41f3abce4a13e7c6ad1606eb708f371de87f created a
little merge conflict.

 libavformat/smoothstreamingenc.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Andreas Rheinhardt June 26, 2020, 11:54 a.m. UTC | #1
Andreas Rheinhardt:
> Nothing written in avformat_write_trailer() for the submuxers will be
> output anyway because the AVIOContexts used for actual output have been
> closed before the call. Writing the trailer of the subcontext has probably
> only been done in order to free the memory allocated by the submuxer.
> And this job has been taken over by the deinit functions.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> Resending because 82bf41f3abce4a13e7c6ad1606eb708f371de87f created a
> little merge conflict.
> 
>  libavformat/smoothstreamingenc.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
> index eefc61d08b..6599687681 100644
> --- a/libavformat/smoothstreamingenc.c
> +++ b/libavformat/smoothstreamingenc.c
> @@ -49,7 +49,6 @@ typedef struct Fragment {
>  
>  typedef struct OutputStream {
>      AVFormatContext *ctx;
> -    int ctx_inited;
>      char dirname[1024];
>      uint8_t iobuf[32768];
>      URLContext *out;  // Current output stream where all output is written
> @@ -173,8 +172,6 @@ static void ism_free(AVFormatContext *s)
>          ffurl_closep(&os->out);
>          ffurl_closep(&os->out2);
>          ffurl_closep(&os->tail_out);
> -        if (os->ctx && os->ctx_inited)
> -            av_write_trailer(os->ctx);
>          if (os->ctx && os->ctx->pb)
>              avio_context_free(&os->ctx->pb);
>          avformat_free_context(os->ctx);
> @@ -357,7 +354,6 @@ static int ism_write_header(AVFormatContext *s)
>          if (ret < 0) {
>               goto fail;
>          }
> -        os->ctx_inited = 1;
>          avio_flush(ctx->pb);
>          s->streams[i]->time_base = st->time_base;
>          if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
> 
Will apply tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index eefc61d08b..6599687681 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -49,7 +49,6 @@  typedef struct Fragment {
 
 typedef struct OutputStream {
     AVFormatContext *ctx;
-    int ctx_inited;
     char dirname[1024];
     uint8_t iobuf[32768];
     URLContext *out;  // Current output stream where all output is written
@@ -173,8 +172,6 @@  static void ism_free(AVFormatContext *s)
         ffurl_closep(&os->out);
         ffurl_closep(&os->out2);
         ffurl_closep(&os->tail_out);
-        if (os->ctx && os->ctx_inited)
-            av_write_trailer(os->ctx);
         if (os->ctx && os->ctx->pb)
             avio_context_free(&os->ctx->pb);
         avformat_free_context(os->ctx);
@@ -357,7 +354,6 @@  static int ism_write_header(AVFormatContext *s)
         if (ret < 0) {
              goto fail;
         }
-        os->ctx_inited = 1;
         avio_flush(ctx->pb);
         s->streams[i]->time_base = st->time_base;
         if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {