summaryrefslogtreecommitdiffstats
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorvacingfang <vacingfang@tencent.com>2019-07-21 21:55:47 +0800
committerJun Zhao <barryjzhao@tencent.com>2019-07-26 09:39:47 +0800
commitd83a3117e2f0b17a7742ec16d8fb39cddc272375 (patch)
treee22e43ef0b9f468c70ff363d009d04b3dceb1a17 /libavformat/hls.c
parent606be4cb503a936a5fc5ecdaa0674164a611f701 (diff)
downloadffmpeg-streaming-d83a3117e2f0b17a7742ec16d8fb39cddc272375.zip
ffmpeg-streaming-d83a3117e2f0b17a7742ec16d8fb39cddc272375.tar.gz
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>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c10
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);
OpenPOWER on IntegriCloud