[FFmpeg-devel] [PATCH V1 3/3] lavf/hls: replace the same code logic with ensure_playlist()

Steven Liu lingjiujianke at gmail.com
Thu Jul 25 08:58:45 EEST 2019


Jun Zhao <mypopydev at gmail.com> 于2019年7月21日周日 下午10:32写道:
>
> From: vacingfang <vacingfang at tencent.com>
>
> Replace the same code logic with ensure_playlist(), it's will
> help reusable blocks of code.
>
> Reviewed-by: Jun Zhao <barryjzhao at tencent.com>
> Signed-off-by: vacingfang <vacingfang at tencent.com>
> ---
>  libavformat/hls.c |   10 +++-------
>  1 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 238ebd0..0522445 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -861,13 +861,9 @@ static int parse_playlist(HLSContext *c, const char *url,
>              }
>              if (is_segment) {
>                  struct segment *seg;
> -                if (!pls) {
> -                    if (!new_variant(c, 0, url, NULL)) {
> -                        ret = AVERROR(ENOMEM);
> -                        goto fail;
> -                    }
> -                    pls = c->playlists[c->n_playlists - 1];
> -                }
> +                ret = ensure_playlist(c, &pls, url);
> +                if (ret < 0)
> +                    goto fail;
>                  seg = av_malloc(sizeof(struct segment));
>                  if (!seg) {
>                      ret = AVERROR(ENOMEM);
> --
> 1.7.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


LGTM

Thanks


More information about the ffmpeg-devel mailing list