Skip to content

Commit

Permalink
Use new MythDownloadManager::cancelDownload(QStringList) API
Browse files Browse the repository at this point in the history
So we only need to wait once for all download to be cancelled.
  • Loading branch information
jyavenard committed Aug 12, 2013
1 parent 5b82fc7 commit a6e0d7d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
Expand Up @@ -82,18 +82,24 @@ static uint64_t mdate(void)
return t.tv_sec * 1000000ULL + t.tv_usec;
}

static bool downloadURL(const QString url, QByteArray *buffer)
static bool downloadURL(const QString &url, QByteArray *buffer)
{
MythDownloadManager *mdm = GetMythDownloadManager();
return mdm->download(url, buffer);
}

static void cancelURL(const QString url)
static void cancelURL(const QString &url)
{
MythDownloadManager *mdm = GetMythDownloadManager();
mdm->cancelDownload(url);
}

static void cancelURL(const QStringList &urls)
{
MythDownloadManager *mdm = GetMythDownloadManager();
mdm->cancelDownload(urls);
}

/* segment container */

class HLSSegment
Expand Down Expand Up @@ -1261,15 +1267,17 @@ class PlaylistWorker : public MThread
m_lock.lock();
// Interrupt on-going downloads of all stream playlists
int streams = m_parent->NumStreams();
QStringList listurls;
for (int i = 0; i < streams; i++)
{
HLSStream *hls = m_parent->GetStream(i);
if (hls)
{
cancelURL(hls->Url());
listurls.append(hls->Url());
}
}
m_lock.unlock();
cancelURL(listurls);
wait();
}

Expand Down

0 comments on commit a6e0d7d

Please sign in to comment.