[FFmpeg-devel] [PATCH V1] lavf/dashdec: drop unnecessary check before ff_format_io_close
mypopy at gmail.com
mypopy at gmail.com
Mon Nov 4 04:31:57 EET 2019
On Tue, Sep 24, 2019 at 12:41 AM Jun Zhao <mypopydev at gmail.com> wrote:
> From: Jun Zhao <barryjzhao at tencent.com>
>
> ff_format_io_close will check the AVIOContext pointer pb, so drop
> the unnecessary check before ff_format_io_close.
>
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
> libavformat/dashdec.c | 12 ++++--------
> 1 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 8c0a9b0..5a49e15 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -363,8 +363,7 @@ static void free_representation(struct representation
> *pls)
> free_fragment(&pls->init_section);
> av_freep(&pls->init_sec_buf);
> av_freep(&pls->pb.buffer);
> - if (pls->input)
> - ff_format_io_close(pls->parent, &pls->input);
> + ff_format_io_close(pls->parent, &pls->input);
> if (pls->ctx) {
> pls->ctx->pb = NULL;
> avformat_close_input(&pls->ctx);
> @@ -2182,8 +2181,7 @@ static void recheck_discard_flags(AVFormatContext
> *s, struct representation **p,
> av_log(s, AV_LOG_INFO, "Now receiving stream_index %d\n",
> pls->stream_index);
> } else if (!needed && pls->ctx) {
> close_demux_for_component(pls);
> - if (pls->input)
> - ff_format_io_close(pls->parent, &pls->input);
> + ff_format_io_close(pls->parent, &pls->input);
> av_log(s, AV_LOG_INFO, "No longer receiving stream_index
> %d\n", pls->stream_index);
> }
> }
> @@ -2244,8 +2242,7 @@ static int dash_read_packet(AVFormatContext *s,
> AVPacket *pkt)
> if (cur->is_restart_needed) {
> cur->cur_seg_offset = 0;
> cur->init_sec_buf_read_offset = 0;
> - if (cur->input)
> - ff_format_io_close(cur->parent, &cur->input);
> + ff_format_io_close(cur->parent, &cur->input);
> ret = reopen_demux_for_component(s, cur);
> cur->is_restart_needed = 0;
> }
> @@ -2283,8 +2280,7 @@ static int dash_seek(AVFormatContext *s, struct
> representation *pls, int64_t see
> return av_seek_frame(pls->ctx, -1, seek_pos_msec * 1000, flags);
> }
>
> - if (pls->input)
> - ff_format_io_close(pls->parent, &pls->input);
> + ff_format_io_close(pls->parent, &pls->input);
>
> // find the nearest fragment
> if (pls->n_timelines > 0 && pls->fragment_timescale > 0) {
> --
> 1.7.1
>
> Ping :)
More information about the ffmpeg-devel
mailing list