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: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: vacingfang <vacingfang@tencent.com>
This commit is contained in:
vacingfang 2019-07-21 21:55:47 +08:00 committed by Jun Zhao
parent 606be4cb50
commit d83a3117e2
1 changed files with 3 additions and 7 deletions

View File

@ -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);