From 15c10618a229087f55aa06c3e6c4f96f442020fc Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 21 Aug 2019 23:47:45 +0900 Subject: [PATCH] hlsdemux: Post error message if hlsdemux could not start decryption _decrypt_start() failure will lead to decryption failure eventually but catching it earlier if possible. The decrpytion start failure means that the hls plugin was built without crypto library or crypto library does not want to accept given key and IV. --- ext/hls/gsthlsdemux.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 968475746a..80cecf42d2 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -770,18 +770,25 @@ gst_hls_demux_start_fragment (GstAdaptiveDemux * demux, if (key == NULL) goto key_failed; - gst_hls_demux_stream_decrypt_start (hls_stream, key->data, - hls_stream->current_iv); + if (!gst_hls_demux_stream_decrypt_start (hls_stream, key->data, + hls_stream->current_iv)) + goto decrypt_start_failed; return TRUE; key_failed: { - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, + GST_ELEMENT_ERROR (demux, STREAM, DECRYPT_NOKEY, ("Couldn't retrieve key for decryption"), (NULL)); GST_WARNING_OBJECT (demux, "Failed to decrypt data"); return FALSE; } +decrypt_start_failed: + { + GST_ELEMENT_ERROR (demux, STREAM, DECRYPT, ("Failed to start decrypt"), + ("Couldn't set key and IV or plugin was built without crypto library")); + return FALSE; + } } static GstHLSTSReaderType