]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: improve hls encrypt get key file operation
authorSteven Liu <lq@chinaffmpeg.org>
Tue, 25 Jul 2017 02:31:29 +0000 (10:31 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Tue, 25 Jul 2017 02:31:29 +0000 (10:31 +0800)
get key file only once time is ok, no need more times.
Ticket-id: #6545

Found-by: JohnPi
Signed-off-by: Steven Liu <lq@onvideo.cn>
libavformat/hlsenc.c

index b0625dc9d43fd4a24053e98415f750794964ac8a..f98f04100c711dfd41fcf13c1a2f800bfafe969c 100644 (file)
@@ -1223,12 +1223,15 @@ static int hls_start(AVFormatContext *s)
             av_log(s, AV_LOG_WARNING, "Cannot use both -hls_key_info_file and -hls_enc,"
                   " will use -hls_key_info_file priority\n");
         }
-        if (c->key_info_file) {
-            if ((err = hls_encryption_start(s)) < 0)
-                goto fail;
-        } else {
-            if ((err = do_encrypt(s)) < 0)
-                goto fail;
+
+        if (c->number <= 1) {
+            if (c->key_info_file) {
+                if ((err = hls_encryption_start(s)) < 0)
+                    goto fail;
+            } else {
+                if ((err = do_encrypt(s)) < 0)
+                    goto fail;
+            }
         }
         if ((err = av_dict_set(&options, "encryption_key", c->key_string, 0))
                 < 0)