ffmpeg | branch: master | vacingfang <vacingf...@tencent.com> | Sun Jul 21 
21:55:47 2019 +0800| [d83a3117e2f0b17a7742ec16d8fb39cddc272375] | committer: 
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: Jun Zhao <barryjz...@tencent.com>
Signed-off-by: vacingfang <vacingf...@tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d83a3117e2f0b17a7742ec16d8fb39cddc272375
---

 libavformat/hls.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 238ebd0729..052244592c 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);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to