Ticket #10934: 10934-partial-fix.patch

File 10934-partial-fix.patch, 3.0 KB (added by danielk, 8 years ago)
  • mythtv/libs/libmythtv/iptv/iptvfeederhls.cpp

    diff --git a/mythtv/libs/libmythtv/iptv/iptvfeederhls.cpp b/mythtv/libs/libmythtv/iptv/iptvfeederhls.cpp
    index a2701be..eeb3722 100644
    a b IPTVFeederHLS::IPTVFeederHLS() : 
    3030IPTVFeederHLS::~IPTVFeederHLS()
    3131{
    3232    Close();
     33    QMutexLocker locker(&m_hlsbufferlock);
    3334    delete[] m_buffer;
    3435}
    3536
    bool IPTVFeederHLS::IsHLS(const QString &url) 
    4142
    4243bool IPTVFeederHLS::IsOpen(void) const
    4344{
     45    QMutexLocker locker(&m_hlsbufferlock);
    4446    if (m_hls == NULL)
    4547        return false;
    4648    return m_hls->IsOpen();
    bool IPTVFeederHLS::Open(const QString &url) 
    5052{
    5153    LOG(VB_RECORD, LOG_INFO, LOC + QString("Open(%1) -- begin").arg(url));
    5254
    53     QMutexLocker locker(&_lock);
     55    QMutexLocker locker(&m_hlsbufferlock);
    5456
    5557    if (m_hls)
    5658    {
    bool IPTVFeederHLS::Open(const QString &url) 
    6769
    6870void IPTVFeederHLS::Run(void)
    6971{
    70     m_lock.lock();
     72    QMutexLocker runlocker(&m_runlock);
    7173    m_running = true;
    7274    m_interrupted = false;
    73     m_lock.unlock();
    7475
    7576    while (!m_interrupted)
    7677    {
     78        runlocker.unlock();
     79
     80        QMutexLocker hlslocker(&m_hlsbufferlock);
     81
    7782        if (m_hls == NULL)
    7883            break;
    79         m_lock.lock();
     84
    8085        uint size = m_hls->Read((void *)m_buffer, BUFFER_SIZE);
    8186        if (m_buffer[0] != 0x47)
    8287        {
    void IPTVFeederHLS::Run(void) 
    9095        for (; it != _listeners.end(); ++it)
    9196            (*it)->AddData(m_buffer, size);
    9297        _lock.unlock();
    93         m_lock.unlock();
     98
     99        runlocker.relock();
    94100    }
    95101
    96102    m_running = false;
    97     m_lock.lock();
    98103    m_waitcond.wakeAll();
    99     m_lock.unlock();
    100104}
    101105
    102106void IPTVFeederHLS::Stop(void)
    103107{
    104108    LOG(VB_RECORD, LOG_INFO, LOC + "Stop() -- begin");
    105     QMutexLocker locker(&m_lock);
     109    QMutexLocker locker(&m_runlock);
    106110    m_interrupted = true;
    107111
    108112    while (m_running)
    109         m_waitcond.wait(&m_lock, 500);
     113        m_waitcond.wait(&m_runlock, 500);
    110114
    111115    LOG(VB_RECORD, LOG_INFO, LOC + "Stop() -- end");
    112116}
    void IPTVFeederHLS::Close(void) 
    116120    LOG(VB_RECORD, LOG_INFO, LOC + "Close() -- begin");
    117121    Stop();
    118122
    119     QMutexLocker lock(&m_lock);
     123    QMutexLocker lock(&m_hlsbufferlock);
    120124    delete m_hls;
    121125    m_hls = NULL;
    122126
  • mythtv/libs/libmythtv/iptv/iptvfeederhls.h

    diff --git a/mythtv/libs/libmythtv/iptv/iptvfeederhls.h b/mythtv/libs/libmythtv/iptv/iptvfeederhls.h
    index 8bd68a7..705ca78 100644
    a b  
    1616class TSDataListener;
    1717class HLSRingBuffer;
    1818
     19// m_hlsbufferlock->_lock
     20
    1921class IPTVFeederHLS : public IPTVFeederLive
    2022{
    2123public:
    public: 
    3335    static bool IsHLS(const QString &url);
    3436
    3537private:
     38    mutable QMutex  m_hlsbufferlock;
    3639    uint8_t        *m_buffer;
    3740    HLSRingBuffer  *m_hls;
    38     mutable QMutex  m_lock;
     41
     42    mutable QMutex  m_runlock;
    3943    QWaitCondition  m_waitcond;
    4044    bool            m_interrupted;
    4145    bool            m_running;