Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix LiveTV when using HLS

IPTVFeederLive::Open is expected to return immediately and not to block for a long time, otherwise the Event thread isn't running and cause the frontend to disconnect prematurely.
Thanks to DanielK for his hint and feedback.

Fixes #10934
  • Loading branch information...
commit 8c551e600f3b993f8b5199e0f02ce79357e0d6ea 1 parent b8e7df5
@jyavenard jyavenard authored
View
17 mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
@@ -1470,6 +1470,21 @@ HLSRingBuffer::HLSRingBuffer(const QString &lfilename) :
OpenFile(lfilename);
}
+HLSRingBuffer::HLSRingBuffer(const QString &lfilename, bool open) :
+ RingBuffer(kRingBuffer_HLS),
+ m_playback(new HLSPlayback()),
+ m_meta(false), m_error(false), m_aesmsg(false),
+ m_startup(0), m_bitrate(0), m_seektoend(false),
+ m_streamworker(NULL), m_playlistworker(NULL), m_fd(NULL),
+ m_interrupted(false)
+{
+ startreadahead = false;
+ if (open)
+ {
+ OpenFile(lfilename);
+ }
+}
+
HLSRingBuffer::~HLSRingBuffer()
{
QWriteLocker lock(&rwlock);
@@ -2195,7 +2210,7 @@ int HLSRingBuffer::Prefetch(int count)
.arg(count));
m_streamworker->Lock();
m_streamworker->Wakeup();
- while (!m_error && (retries < 20) &&
+ while (!m_error && !m_interrupted && (retries < 20) &&
(m_streamworker->CurrentPlaybackBuffer(false) < count) &&
!m_streamworker->IsAtEnd())
{
View
1  mythtv/libs/libmythtv/HLS/httplivestreambuffer.h
@@ -44,6 +44,7 @@ class HLSRingBuffer : public RingBuffer
{
public:
HLSRingBuffer(const QString &lfilename);
+ HLSRingBuffer(const QString &lfilename, bool open);
virtual ~HLSRingBuffer();
virtual bool IsOpen(void) const;
View
13 mythtv/libs/libmythtv/iptv/iptvfeederhls.cpp
@@ -23,7 +23,7 @@
IPTVFeederHLS::IPTVFeederHLS() :
m_buffer(new uint8_t[BUFFER_SIZE]), m_hls(NULL),
- m_interrupted(false), m_running(false)
+ m_interrupted(false), m_running(false), m_init(false)
{
}
@@ -58,7 +58,8 @@ bool IPTVFeederHLS::Open(const QString &url)
return true;
}
- m_hls = new HLSRingBuffer(url);
+ m_url = url;
+ m_hls = new HLSRingBuffer(url, false);
LOG(VB_RECORD, LOG_INFO, LOC + "Open() -- end");
@@ -73,7 +74,12 @@ void IPTVFeederHLS::Run(void)
m_lock.unlock();
m_hls->Continue();
- while (!m_interrupted)
+ if (!m_init)
+ {
+ m_init = m_hls->OpenFile(m_url);
+ }
+
+ while (!m_interrupted && m_init)
{
if (m_hls == NULL)
break;
@@ -130,6 +136,7 @@ void IPTVFeederHLS::Close(void)
QMutexLocker lock(&m_lock);
delete m_hls;
m_hls = NULL;
+ m_init = false;
LOG(VB_RECORD, LOG_INFO, LOC + "Close() -- end");
}
View
2  mythtv/libs/libmythtv/iptv/iptvfeederhls.h
@@ -34,11 +34,13 @@ class IPTVFeederHLS : public IPTVFeederLive
private:
uint8_t *m_buffer;
+ QString m_url;
HLSRingBuffer *m_hls;
mutable QMutex m_lock;
QWaitCondition m_waitcond;
bool m_interrupted;
bool m_running;
+ bool m_init;
};
#endif

0 comments on commit 8c551e6

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