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>
... | ... |
@@ -1223,12 +1223,15 @@ static int hls_start(AVFormatContext *s) |
1223 | 1223 |
av_log(s, AV_LOG_WARNING, "Cannot use both -hls_key_info_file and -hls_enc," |
1224 | 1224 |
" will use -hls_key_info_file priority\n"); |
1225 | 1225 |
} |
1226 |
- if (c->key_info_file) { |
|
1227 |
- if ((err = hls_encryption_start(s)) < 0) |
|
1228 |
- goto fail; |
|
1229 |
- } else { |
|
1230 |
- if ((err = do_encrypt(s)) < 0) |
|
1231 |
- goto fail; |
|
1226 |
+ |
|
1227 |
+ if (c->number <= 1) { |
|
1228 |
+ if (c->key_info_file) { |
|
1229 |
+ if ((err = hls_encryption_start(s)) < 0) |
|
1230 |
+ goto fail; |
|
1231 |
+ } else { |
|
1232 |
+ if ((err = do_encrypt(s)) < 0) |
|
1233 |
+ goto fail; |
|
1234 |
+ } |
|
1232 | 1235 |
} |
1233 | 1236 |
if ((err = av_dict_set(&options, "encryption_key", c->key_string, 0)) |
1234 | 1237 |
< 0) |