Skip to content
Browse files

Fix playback of HLS encrypted streams.

The allows ABC iView on iPad to stream to Myth
  • Loading branch information...
1 parent 83872a3 commit c5a4229401b2c224640cda2a31e9339fcd8157de @jyavenard jyavenard committed
Showing with 13 additions and 6 deletions.
  1. +13 −6 mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
View
19 mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
@@ -265,11 +265,18 @@ class HLSSegment
return RET_OK;
QByteArray key;
bool ret = downloadURL(m_psz_key_path, &key);
- if (ret != RET_OK || key.size() != AES_BLOCK_SIZE)
+ if (!ret || key.size() != AES_BLOCK_SIZE)
{
- LOG(VB_PLAYBACK, LOG_ERR, LOC +
- QString("The AES key loaded doesn't have the right size (%1)")
- .arg(key.size()));
+ if (ret)
+ {
+ LOG(VB_PLAYBACK, LOG_ERR, LOC +
+ QString("The AES key loaded doesn't have the right size (%1)")
+ .arg(key.size()));
+ }
+ else
+ {
+ LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to download AES key");
+ }
return RET_ERROR;
}
AES_set_decrypt_key((const unsigned char*)key.constData(), 128, &m_aeskey);
@@ -309,7 +316,7 @@ class HLSSegment
m_data.size() - aeslen);
// remove the PKCS#7 padding from the buffer
- int pad = m_data[m_data.size()-1];
+ int pad = decrypted_data[m_data.size()-1];
if (pad <= 0 || pad > AES_BLOCK_SIZE)
{
LOG(VB_PLAYBACK, LOG_ERR, LOC +
@@ -1987,7 +1994,7 @@ int HLSRingBuffer::ParseKey(HLSStream *hls, const QString line)
hls->SetKeyPath(decoded_URI(uri.remove(QChar(QLatin1Char('"')))));
iv = ParseAttributes(line, "IV");
- if (!hls->SetAESIV(iv))
+ if (!iv.isNull() && !hls->SetAESIV(iv))
{
LOG(VB_PLAYBACK, LOG_ERR, LOC + "invalid IV");
err = RET_ERROR;

0 comments on commit c5a4229

Please sign in to comment.
Something went wrong with that request. Please try again.