[FFmpeg-devel] [PATCH 3/6] avformat: remove uneeded avio_flush() calls from the end of write_trailer functions
Marton Balint
cus at passwd.hu
Sun Jan 5 15:14:10 EET 2020
The IO context is always flushed by libavformat/mux.c after write_trailer is
called, so this change should have no effect at all.
---
libavformat/aiffenc.c | 2 --
libavformat/astenc.c | 1 -
libavformat/au.c | 1 -
libavformat/cafenc.c | 1 -
libavformat/flacenc.c | 1 -
libavformat/hashenc.c | 1 -
libavformat/mmf.c | 2 --
libavformat/mpegenc.c | 1 -
libavformat/soxenc.c | 2 --
libavformat/ttaenc.c | 1 -
libavformat/vc1testenc.c | 1 -
libavformat/wavenc.c | 2 --
libavformat/wtvenc.c | 2 --
13 files changed, 18 deletions(-)
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index ec2c7db09a..0145596bec 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -263,8 +263,6 @@ static int aiff_write_trailer(AVFormatContext *s)
file_size = avio_tell(pb);
avio_seek(pb, aiff->form, SEEK_SET);
avio_wb32(pb, file_size - aiff->form - 4);
-
- avio_flush(pb);
}
return ret;
diff --git a/libavformat/astenc.c b/libavformat/astenc.c
index d38a3aab38..e0b94b8b63 100644
--- a/libavformat/astenc.c
+++ b/libavformat/astenc.c
@@ -178,7 +178,6 @@ static int ast_write_trailer(AVFormatContext *s)
}
avio_seek(pb, file_size, SEEK_SET);
- avio_flush(pb);
}
return 0;
}
diff --git a/libavformat/au.c b/libavformat/au.c
index 19a0f56963..4afee85a94 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -326,7 +326,6 @@ static int au_write_trailer(AVFormatContext *s)
avio_seek(pb, 8, SEEK_SET);
avio_wb32(pb, (uint32_t)(file_size - au->header_size));
avio_seek(pb, file_size, SEEK_SET);
- avio_flush(pb);
}
return 0;
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 8fe1dcef19..98d4d9212f 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -258,7 +258,6 @@ static int caf_write_trailer(AVFormatContext *s)
avio_write(pb, caf->pkt_sizes, caf->size_entries_used);
caf->size_buffer_size = 0;
}
- avio_flush(pb);
}
av_freep(&caf->pkt_sizes);
return 0;
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index abbed38f89..1aae0c97e0 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -349,7 +349,6 @@ static int flac_write_trailer(struct AVFormatContext *s)
avio_seek(pb, 8, SEEK_SET);
avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
avio_seek(pb, file_size, SEEK_SET);
- avio_flush(pb);
} else {
av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
}
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 34a8fd1f50..ddc67f53b5 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -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_strlcatf(buf, sizeof(buf), "\n");
avio_write(s->pb, buf, strlen(buf));
- avio_flush(s->pb);
}
return 0;
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 4e087fc920..e4768db064 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -171,8 +171,6 @@ static int mmf_write_trailer(AVFormatContext *s)
avio_write(pb, "\x00\x00\x00\x00", 4);
avio_seek(pb, pos, SEEK_SET);
-
- avio_flush(pb);
}
return 0;
}
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index f6980231a2..f8039a42c0 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -1244,7 +1244,6 @@ static int mpeg_mux_end(AVFormatContext *ctx)
* it as it is usually not needed by decoders and because it
* complicates MPEG stream concatenation. */
// avio_wb32(ctx->pb, ISO_11172_END_CODE);
- // avio_flush(ctx->pb);
for (i = 0; i < ctx->nb_streams; i++) {
stream = ctx->streams[i]->priv_data;
diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c
index 7259131b03..ce276f88b5 100644
--- a/libavformat/soxenc.c
+++ b/libavformat/soxenc.c
@@ -99,8 +99,6 @@ static int sox_write_trailer(AVFormatContext *s)
} else
avio_wb64(pb, num_samples);
avio_seek(pb, file_size, SEEK_SET);
-
- avio_flush(pb);
}
return 0;
diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index 73c29ae936..4860aab4c1 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -154,7 +154,6 @@ static int tta_write_trailer(AVFormatContext *s)
tta_queue_flush(s);
ff_ape_write_tag(s);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
index cf95d1d80d..1365bdd660 100644
--- a/libavformat/vc1testenc.c
+++ b/libavformat/vc1testenc.c
@@ -76,7 +76,6 @@ static int vc1test_write_trailer(AVFormatContext *s)
if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
avio_seek(pb, 0, SEEK_SET);
avio_wl24(pb, ctx->frames);
- avio_flush(pb);
}
return 0;
}
diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index c44d6d26e9..ea7573139c 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -478,7 +478,6 @@ static int wav_write_trailer(AVFormatContext *s)
avio_wl32(pb, -1);
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_flush(pb);
}
return 0;
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 4a68b8133f..498bc64019 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -823,8 +823,6 @@ static int write_trailer(AVFormatContext *s)
avio_seek(pb, 0x5c, SEEK_SET);
avio_wl32(pb, file_end_pos >> WTV_SECTOR_BITS);
- avio_flush(pb);
-
av_free(wctx->sp_pairs);
av_free(wctx->st_pairs);
av_packet_unref(&wctx->thumbnail);
--
2.16.4
More information about the ffmpeg-devel
mailing list