[FFmpeg-devel] [PATCH 3/4] avformat/mux: do not call write_header multiple times if it fails the first time

Marton Balint cus at passwd.hu
Sat Jun 11 23:54:31 CEST 2016



On Sat, 11 Jun 2016, Michael Niedermayer wrote:

> On Sat, Jun 11, 2016 at 08:33:42PM +0200, Marton Balint wrote:
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  libavformat/internal.h | 1 +
>>  libavformat/mux.c      | 5 +++--
>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/internal.h b/libavformat/internal.h
>> index 40ba089..b6c2020 100644
>> --- a/libavformat/internal.h
>> +++ b/libavformat/internal.h
>> @@ -124,6 +124,7 @@ struct AVFormatInternal {
>>       * Whether or not a header has already been written
>>       */
>>      int header_written;
>> +    int write_header_ret;
>>  };
>>
>>  struct AVStreamInternal {
>> diff --git a/libavformat/mux.c b/libavformat/mux.c
>> index 08ed940..b1b65a1 100644
>> --- a/libavformat/mux.c
>> +++ b/libavformat/mux.c
>> @@ -479,6 +479,7 @@ static int write_header_internal(AVFormatContext *s)
>>          int ret = s->oformat->write_header(s);
>>          if (ret >= 0 && s->pb && s->pb->error < 0)
>>              ret = s->pb->error;
>> +        s->internal->write_header_ret = ret;
>
> would
> header_written = ret
> be simpler ?

I can change it, but I found it a little less readable.

Regards,
Marton


More information about the ffmpeg-devel mailing list