diff mbox series

[FFmpeg-devel,1/6] avformat: remove unneded avio_flush() calls before calling avio_close_dyn_buf()

Message ID 20200105131413.22707-1-cus@passwd.hu
State New
Headers show
Series [FFmpeg-devel,1/6] avformat: remove unneded avio_flush() calls before calling avio_close_dyn_buf() | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Marton Balint Jan. 5, 2020, 1:14 p.m. UTC
avio_close_dyn_buf() also does avio_flush().

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/hlsenc.c | 2 --
 libavformat/oggenc.c | 1 -
 libavformat/rtpdec.c | 2 --
 3 files changed, 5 deletions(-)

Comments

Martin Storsjö Jan. 5, 2020, 8:28 p.m. UTC | #1
On Sun, 5 Jan 2020, Marton Balint wrote:

> avio_close_dyn_buf() also does avio_flush().
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/hlsenc.c | 2 --
> libavformat/oggenc.c | 1 -
> libavformat/rtpdec.c | 2 --
> 3 files changed, 5 deletions(-)

LGTM

// Martin
Moritz Barsnick Jan. 6, 2020, 9:22 a.m. UTC | #2
On Sun, Jan 05, 2020 at 14:14:08 +0100, Marton Balint wrote:
> Subject: avformat: remove unneded avio_flush() calls before calling avio_close_dyn_buf()
                            ^
Pasky nit: "unneeded". ;-)
Marton Balint Jan. 7, 2020, 9:22 p.m. UTC | #3
On Mon, 6 Jan 2020, Moritz Barsnick wrote:

> On Sun, Jan 05, 2020 at 14:14:08 +0100, Marton Balint wrote:
>> Subject: avformat: remove unneded avio_flush() calls before calling avio_close_dyn_buf()
>                            ^
> Pasky nit: "unneeded". ;-)

Yeah, I managed to write it in 3 different ways, I fixed those before 
pushing.

Thanks,
Marton
Liu Steven Jan. 18, 2020, 2:06 p.m. UTC | #4
> 在 2020年1月5日,21:14,Marton Balint <cus@passwd.hu> 写道:
> 
> avio_close_dyn_buf() also does avio_flush().
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/hlsenc.c | 2 --
> libavformat/oggenc.c | 1 -
> libavformat/rtpdec.c | 2 --
> 3 files changed, 5 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 561e3ff736..d130f03ea6 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -459,7 +459,6 @@ static int flush_dynbuf(VariantStream *vs, int *range_length)
> 
>     // flush
>     av_write_frame(ctx, NULL);
> -    avio_flush(ctx->pb);
> 
>     // write out to file
>     *range_length = avio_close_dyn_buf(ctx->pb, &vs->temp_buffer);
> @@ -2548,7 +2547,6 @@ static int hls_write_trailer(struct AVFormatContext *s)
>             if (!vs->init_range_length) {
>                 uint8_t *buffer = NULL;
>                 av_write_frame(oc, NULL); /* Flush any buffered data */
> -                avio_flush(oc->pb);
> 
>                 range_length = avio_close_dyn_buf(oc->pb, &buffer);
>                 avio_write(vs->out, buffer, range_length);
> diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
> index d3ae07351d..04f7813083 100644
> --- a/libavformat/oggenc.c
> +++ b/libavformat/oggenc.c
> @@ -133,7 +133,6 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
>     avio_write(pb, page->data, page->size);
> 
>     ogg_update_checksum(s, pb, crc_offset);
> -    avio_flush(pb);
> 
>     size = avio_close_dyn_buf(pb, &buf);
>     if (size < 0)
> diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
> index e75a34cb93..3d5b200099 100644
> --- a/libavformat/rtpdec.c
> +++ b/libavformat/rtpdec.c
> @@ -415,7 +415,6 @@ void ff_rtp_send_punch_packets(URLContext *rtp_handle)
>     avio_wb32(pb, 0); /* Timestamp */
>     avio_wb32(pb, 0); /* SSRC */
> 
> -    avio_flush(pb);
>     len = avio_close_dyn_buf(pb, &buf);
>     if ((len > 0) && buf)
>         ffurl_write(rtp_handle, buf, len);
> @@ -430,7 +429,6 @@ void ff_rtp_send_punch_packets(URLContext *rtp_handle)
>     avio_wb16(pb, 1); /* length in words - 1 */
>     avio_wb32(pb, 0); /* our own SSRC */
> 
> -    avio_flush(pb);
>     len = avio_close_dyn_buf(pb, &buf);
>     if ((len > 0) && buf)
>         ffurl_write(rtp_handle, buf, len);
> -- 
> 2.16.4
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
LGTM
Thanks
Steven
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 561e3ff736..d130f03ea6 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -459,7 +459,6 @@  static int flush_dynbuf(VariantStream *vs, int *range_length)
 
     // flush
     av_write_frame(ctx, NULL);
-    avio_flush(ctx->pb);
 
     // write out to file
     *range_length = avio_close_dyn_buf(ctx->pb, &vs->temp_buffer);
@@ -2548,7 +2547,6 @@  static int hls_write_trailer(struct AVFormatContext *s)
             if (!vs->init_range_length) {
                 uint8_t *buffer = NULL;
                 av_write_frame(oc, NULL); /* Flush any buffered data */
-                avio_flush(oc->pb);
 
                 range_length = avio_close_dyn_buf(oc->pb, &buffer);
                 avio_write(vs->out, buffer, range_length);
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index d3ae07351d..04f7813083 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -133,7 +133,6 @@  static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
     avio_write(pb, page->data, page->size);
 
     ogg_update_checksum(s, pb, crc_offset);
-    avio_flush(pb);
 
     size = avio_close_dyn_buf(pb, &buf);
     if (size < 0)
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index e75a34cb93..3d5b200099 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -415,7 +415,6 @@  void ff_rtp_send_punch_packets(URLContext *rtp_handle)
     avio_wb32(pb, 0); /* Timestamp */
     avio_wb32(pb, 0); /* SSRC */
 
-    avio_flush(pb);
     len = avio_close_dyn_buf(pb, &buf);
     if ((len > 0) && buf)
         ffurl_write(rtp_handle, buf, len);
@@ -430,7 +429,6 @@  void ff_rtp_send_punch_packets(URLContext *rtp_handle)
     avio_wb16(pb, 1); /* length in words - 1 */
     avio_wb32(pb, 0); /* our own SSRC */
 
-    avio_flush(pb);
     len = avio_close_dyn_buf(pb, &buf);
     if ((len > 0) && buf)
         ffurl_write(rtp_handle, buf, len);