diff mbox series

[FFmpeg-devel,2/6] avformat/hlsenc: Remove redundant initializations

Message ID 20200509191509.9812-2-andreas.rheinhardt@gmail.com
State Accepted
Commit d41c93d1556e3021ebfec803e621815252afbd44
Headers show
Series [FFmpeg-devel,1/6] avformat/hlsenc: Don't reset AVIOContext pointer manually a second time
Related show

Checks

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

Commit Message

Andreas Rheinhardt May 9, 2020, 7:15 p.m. UTC
For every variantstream vs, vs->packets_written is set to one, only to be
set to zero a few lines below. Given that the relevant structure has
been zeroed during the allocation, this commit removes both assignments.
A redundant initialization for vs->init_range_length has been removed as
well a few lines below. Given that the relevant structure has been
zeroed during the allocation, this commit removes both assignments. A
redundant initialization for vs->init_range_length has been removed as
well.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/hlsenc.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Steven Liu May 10, 2020, 2:02 a.m. UTC | #1
> 2020年5月10日 上午3:15,Andreas Rheinhardt <andreas.rheinhardt@gmail.com> 写道:
> 
> For every variantstream vs, vs->packets_written is set to one, only to be
> set to zero a few lines below. Given that the relevant structure has
> been zeroed during the allocation, this commit removes both assignments.
> A redundant initialization for vs->init_range_length has been removed as
> well a few lines below. Given that the relevant structure has been
> zeroed during the allocation, this commit removes both assignments. A
> redundant initialization for vs->init_range_length has been removed as
> well.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> libavformat/hlsenc.c | 4 ----
> 1 file changed, 4 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index a796c124dd..afb4d2a0c0 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -833,7 +833,6 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
>         av_dict_copy(&st->metadata, vs->streams[i]->metadata, 0);
>     }
> 
> -    vs->packets_written = 1;
>     vs->start_pos = 0;
>     vs->new_start = 1;
> 
> @@ -848,9 +847,6 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
>         }
>     }
> 
> -    vs->packets_written = 0;
> -    vs->init_range_length = 0;
> -
>     if ((ret = avio_open_dyn_buf(&oc->pb)) < 0)
>         return ret;
> 
> -- 
> 2.20.1
> 
> _______________________________________________
> 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 Liu
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index a796c124dd..afb4d2a0c0 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -833,7 +833,6 @@  static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
         av_dict_copy(&st->metadata, vs->streams[i]->metadata, 0);
     }
 
-    vs->packets_written = 1;
     vs->start_pos = 0;
     vs->new_start = 1;
 
@@ -848,9 +847,6 @@  static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
         }
     }
 
-    vs->packets_written = 0;
-    vs->init_range_length = 0;
-
     if ((ret = avio_open_dyn_buf(&oc->pb)) < 0)
         return ret;