Skip to content

Commit

Permalink
IPTV Download not OK with network error (#999)
Browse files Browse the repository at this point in the history
* IPTV Download not OK with network error

Set download status to not OK when a network error is reported
for the download. This fixes an endless loop / log pollution when
server access is not allowed, reported as  error 201 (HTTP error 403).

* IPTV Use PROGRAM-ID value 1 if not specified

The PROGRAM-ID attribute of the EXT-X-STREAM-INF is removed in
version 6 of the protocol as described in rfc8216.
Searching through a large number of M3U8 files shows that the
PROGRAM-ID value is always 1 when specified. Therefore, if the
attribute is not specified then value 1 is used instead of -1.
  • Loading branch information
kmdewaal authored Dec 20, 2024
1 parent af8d7e1 commit 3a8973a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions mythtv/libs/libmythtv/HLS/m3u.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,15 @@ namespace M3U
*/
QString attr;

/* The PROGRAM-ID attribute of the EXT-X-STREAM-INF and the EXT-X-I-
* FRAME-STREAM-INF tags was removed in protocol version 6.
*/
attr = ParseAttributes(line, "PROGRAM-ID");
if (attr.isNull())
{
LOG(VB_RECORD, LOG_INFO, loc +
"#EXT-X-STREAM-INF: expected PROGRAM-ID=<value>, using -1");
id = -1;
"#EXT-X-STREAM-INF: No PROGRAM-ID=<value>, using 1");
id = 1;
}
else
{
Expand Down Expand Up @@ -273,6 +276,7 @@ namespace M3U
if (!ParseDecimalValue(line, sequence_num))
{
LOG(VB_RECORD, LOG_ERR, loc + "expected #EXT-X-MEDIA-SEQUENCE:<s>");
sequence_num = 0;
return false;
}

Expand Down Expand Up @@ -391,6 +395,8 @@ namespace M3U
* #EXT-X-ALLOW-CACHE:<YES|NO>
*/

/* The EXT-X-ALLOW-CACHE tag was removed in protocol version 7.
*/
int pos = line.indexOf(QLatin1String(":"));
if (pos < 0)
{
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ bool HTTPReader::DownloadStream(const QUrl& url)
QMutexLocker replylock(&m_replylock);
if (m_reply->error() != QNetworkReply::NoError)
{
LOG(VB_RECORD, LOG_ERR, LOC + "DownloadStream exited with " + m_reply->errorString());
LOG(VB_RECORD, LOG_ERR, LOC + "DownloadStream exited with error " +
QString("%1 '%2'").arg(m_reply->error()).arg(m_reply->errorString()));

// Download is not OK when there is a network error
m_ok = false;
}

delete m_reply;
Expand Down

0 comments on commit 3a8973a

Please sign in to comment.