avformat: remove unneeded avio_flush() calls from the end of write_trailer functions

The IO context is always flushed by libavformat/mux.c after write_trailer is
called, so this change should have no effect at all.
pull/331/head
Marton Balint 5 years ago
parent 4bf90e095b
commit c05d82fa92
  1. 2
      libavformat/aiffenc.c
  2. 1
      libavformat/astenc.c
  3. 1
      libavformat/au.c
  4. 1
      libavformat/cafenc.c
  5. 1
      libavformat/flacenc.c
  6. 1
      libavformat/hashenc.c
  7. 2
      libavformat/mmf.c
  8. 1
      libavformat/mpegenc.c
  9. 2
      libavformat/soxenc.c
  10. 1
      libavformat/ttaenc.c
  11. 1
      libavformat/vc1testenc.c
  12. 2
      libavformat/wavenc.c
  13. 2
      libavformat/wtvenc.c

@ -263,8 +263,6 @@ static int aiff_write_trailer(AVFormatContext *s)
file_size = avio_tell(pb); file_size = avio_tell(pb);
avio_seek(pb, aiff->form, SEEK_SET); avio_seek(pb, aiff->form, SEEK_SET);
avio_wb32(pb, file_size - aiff->form - 4); avio_wb32(pb, file_size - aiff->form - 4);
avio_flush(pb);
} }
return ret; return ret;

@ -178,7 +178,6 @@ static int ast_write_trailer(AVFormatContext *s)
} }
avio_seek(pb, file_size, SEEK_SET); avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
} }
return 0; return 0;
} }

@ -326,7 +326,6 @@ static int au_write_trailer(AVFormatContext *s)
avio_seek(pb, 8, SEEK_SET); avio_seek(pb, 8, SEEK_SET);
avio_wb32(pb, (uint32_t)(file_size - au->header_size)); avio_wb32(pb, (uint32_t)(file_size - au->header_size));
avio_seek(pb, file_size, SEEK_SET); avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
} }
return 0; return 0;

@ -258,7 +258,6 @@ static int caf_write_trailer(AVFormatContext *s)
avio_write(pb, caf->pkt_sizes, caf->size_entries_used); avio_write(pb, caf->pkt_sizes, caf->size_entries_used);
caf->size_buffer_size = 0; caf->size_buffer_size = 0;
} }
avio_flush(pb);
} }
av_freep(&caf->pkt_sizes); av_freep(&caf->pkt_sizes);
return 0; return 0;

@ -349,7 +349,6 @@ static int flac_write_trailer(struct AVFormatContext *s)
avio_seek(pb, 8, SEEK_SET); avio_seek(pb, 8, SEEK_SET);
avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
avio_seek(pb, file_size, SEEK_SET); avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
} else { } else {
av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n"); av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
} }

@ -152,7 +152,6 @@ static int hash_write_trailer(struct AVFormatContext *s)
av_hash_final_hex(c->hashes[i], buf + strlen(buf), sizeof(buf) - strlen(buf)); av_hash_final_hex(c->hashes[i], buf + strlen(buf), sizeof(buf) - strlen(buf));
av_strlcatf(buf, sizeof(buf), "\n"); av_strlcatf(buf, sizeof(buf), "\n");
avio_write(s->pb, buf, strlen(buf)); avio_write(s->pb, buf, strlen(buf));
avio_flush(s->pb);
} }
return 0; return 0;

@ -171,8 +171,6 @@ static int mmf_write_trailer(AVFormatContext *s)
avio_write(pb, "\x00\x00\x00\x00", 4); avio_write(pb, "\x00\x00\x00\x00", 4);
avio_seek(pb, pos, SEEK_SET); avio_seek(pb, pos, SEEK_SET);
avio_flush(pb);
} }
return 0; return 0;
} }

@ -1244,7 +1244,6 @@ static int mpeg_mux_end(AVFormatContext *ctx)
* it as it is usually not needed by decoders and because it * it as it is usually not needed by decoders and because it
* complicates MPEG stream concatenation. */ * complicates MPEG stream concatenation. */
// avio_wb32(ctx->pb, ISO_11172_END_CODE); // avio_wb32(ctx->pb, ISO_11172_END_CODE);
// avio_flush(ctx->pb);
for (i = 0; i < ctx->nb_streams; i++) { for (i = 0; i < ctx->nb_streams; i++) {
stream = ctx->streams[i]->priv_data; stream = ctx->streams[i]->priv_data;

@ -99,8 +99,6 @@ static int sox_write_trailer(AVFormatContext *s)
} else } else
avio_wb64(pb, num_samples); avio_wb64(pb, num_samples);
avio_seek(pb, file_size, SEEK_SET); avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
} }
return 0; return 0;

@ -154,7 +154,6 @@ static int tta_write_trailer(AVFormatContext *s)
tta_queue_flush(s); tta_queue_flush(s);
ff_ape_write_tag(s); ff_ape_write_tag(s);
avio_flush(s->pb);
return 0; return 0;
} }

@ -76,7 +76,6 @@ static int vc1test_write_trailer(AVFormatContext *s)
if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
avio_seek(pb, 0, SEEK_SET); avio_seek(pb, 0, SEEK_SET);
avio_wl24(pb, ctx->frames); avio_wl24(pb, ctx->frames);
avio_flush(pb);
} }
return 0; return 0;
} }

@ -478,7 +478,6 @@ static int wav_write_trailer(AVFormatContext *s)
avio_wl32(pb, -1); avio_wl32(pb, -1);
avio_seek(pb, file_size, SEEK_SET); avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
} }
} }
@ -605,7 +604,6 @@ static int w64_write_trailer(AVFormatContext *s)
} }
avio_seek(pb, file_size, SEEK_SET); avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
} }
return 0; return 0;

@ -823,8 +823,6 @@ static int write_trailer(AVFormatContext *s)
avio_seek(pb, 0x5c, SEEK_SET); avio_seek(pb, 0x5c, SEEK_SET);
avio_wl32(pb, file_end_pos >> WTV_SECTOR_BITS); avio_wl32(pb, file_end_pos >> WTV_SECTOR_BITS);
avio_flush(pb);
av_free(wctx->sp_pairs); av_free(wctx->sp_pairs);
av_free(wctx->st_pairs); av_free(wctx->st_pairs);
av_packet_unref(&wctx->thumbnail); av_packet_unref(&wctx->thumbnail);

Loading…
Cancel
Save