Skip to content
Browse files

Fixes #10957. Block EIT channel changes during other channel changes.

  • Loading branch information...
1 parent 7d01e69 commit 53d417d77ca317d3b05f921cb2c69e976b7cf823 @daniel-kristjansson daniel-kristjansson committed Aug 3, 2012
Showing with 14 additions and 8 deletions.
  1. +11 −6 mythtv/libs/libmythtv/tv_rec.cpp
  2. +3 −2 mythtv/libs/libmythtv/tv_rec.h
View
17 mythtv/libs/libmythtv/tv_rec.cpp
@@ -3060,7 +3060,8 @@ QString TVRec::SetInput(QString input, uint requestType)
*/
void TVRec::SetChannel(QString name, uint requestType)
{
- QMutexLocker locker(&stateChangeLock);
+ QMutexLocker locker1(&setChannelLock);
+ QMutexLocker locker2(&stateChangeLock);
LOG(VB_CHANNEL, LOG_INFO, LOC +
QString("SetChannel(%1) -- begin").arg(name));
@@ -3112,14 +3113,18 @@ bool TVRec::QueueEITChannelChange(const QString &name)
QString("QueueEITChannelChange(%1) -- begin").arg(name));
bool ok = false;
- if (stateChangeLock.tryLock())
+ if (setChannelLock.tryLock())
{
- if (tuningRequests.empty())
+ if (stateChangeLock.tryLock())
{
- tuningRequests.enqueue(TuningRequest(kFlagEITScan, name));
- ok = true;
+ if (tuningRequests.empty())
+ {
+ tuningRequests.enqueue(TuningRequest(kFlagEITScan, name));
+ ok = true;
+ }
+ stateChangeLock.unlock();
}
- stateChangeLock.unlock();
+ setChannelLock.unlock();
}
LOG(VB_CHANNEL, LOG_INFO, LOC +
View
5 mythtv/libs/libmythtv/tv_rec.h
@@ -21,8 +21,8 @@
#include "mythconfig.h"
// locking order
-// stateChangeLock -> triggerEventLoopLock
-// -> pendingRecLock
+// setChannelLock -> stateChangeLock -> triggerEventLoopLock
+// -> pendingRecLock
class RingBuffer;
class EITScanner;
@@ -354,6 +354,7 @@ class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable
FireWireDBOptions fwOpt;
// State variables
+ mutable QMutex setChannelLock;
mutable QMutex stateChangeLock;
mutable QMutex pendingRecLock;
TVState internalState;

0 comments on commit 53d417d

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