aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2017-07-25 10:31:29 +0800
committerSteven Liu <lq@chinaffmpeg.org>2017-07-25 10:31:29 +0800
commit805ce25b1d2f08ac4a8e9dcdb9657ad5f5e83d9e (patch)
tree8722d34eacb384585b8a0f480822a340a3283ab9
parent03a9e6ff303ad82e75b734edbe4917ca5fd60159 (diff)
downloadffmpeg-805ce25b1d2f08ac4a8e9dcdb9657ad5f5e83d9e.tar.gz
avformat/hlsenc: improve hls encrypt get key file operation
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>
-rw-r--r--libavformat/hlsenc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index b0625dc9d4..f98f04100c 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -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)