Commit d83a3117 authored by vacingfang's avatar vacingfang Committed by Jun Zhao

lavf/hls: replace the same code logic with ensure_playlist()

Replace the same code logic with ensure_playlist(), it's will
help reusable blocks of code.
Reviewed-by: 's avatarJun Zhao <barryjzhao@tencent.com>
Signed-off-by: 's avatarvacingfang <vacingfang@tencent.com>
parent 606be4cb
...@@ -861,13 +861,9 @@ static int parse_playlist(HLSContext *c, const char *url, ...@@ -861,13 +861,9 @@ static int parse_playlist(HLSContext *c, const char *url,
} }
if (is_segment) { if (is_segment) {
struct segment *seg; struct segment *seg;
if (!pls) { ret = ensure_playlist(c, &pls, url);
if (!new_variant(c, 0, url, NULL)) { if (ret < 0)
ret = AVERROR(ENOMEM); goto fail;
goto fail;
}
pls = c->playlists[c->n_playlists - 1];
}
seg = av_malloc(sizeof(struct segment)); seg = av_malloc(sizeof(struct segment));
if (!seg) { if (!seg) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment