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.
This commit is contained in:
Seungha Yang 2019-08-21 23:47:45 +09:00
parent 98b303498a
commit 15c10618a2

View file

@ -770,18 +770,25 @@ gst_hls_demux_start_fragment (GstAdaptiveDemux * demux,
if (key == NULL) if (key == NULL)
goto key_failed; goto key_failed;
gst_hls_demux_stream_decrypt_start (hls_stream, key->data, if (!gst_hls_demux_stream_decrypt_start (hls_stream, key->data,
hls_stream->current_iv); hls_stream->current_iv))
goto decrypt_start_failed;
return TRUE; return TRUE;
key_failed: key_failed:
{ {
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, GST_ELEMENT_ERROR (demux, STREAM, DECRYPT_NOKEY,
("Couldn't retrieve key for decryption"), (NULL)); ("Couldn't retrieve key for decryption"), (NULL));
GST_WARNING_OBJECT (demux, "Failed to decrypt data"); GST_WARNING_OBJECT (demux, "Failed to decrypt data");
return FALSE; 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 static GstHLSTSReaderType