diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.cpp b/mythtv/libs/libmythtv/recorders/dvbchannel.cpp
index ba31daa1e3..0911d740e4 100644
a
|
b
|
DVBChannel::DVBChannel(QString aDevice, TVRec *parent) |
77 | 77 | : DTVChannel(parent), m_device(std::move(aDevice)) |
78 | 78 | { |
79 | 79 | s_master_map_lock.lockForWrite(); |
80 | | QString key = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, m_device); |
| 80 | m_key = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, m_device); |
81 | 81 | if (m_pParent) |
82 | | key += QString(":%1") |
| 82 | m_key += QString(":%1") |
83 | 83 | .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); |
84 | | s_master_map[key].push_back(this); // == RegisterForMaster |
85 | | auto *master = dynamic_cast<DVBChannel*>(s_master_map[key].front()); |
| 84 | |
| 85 | s_master_map[m_key].push_back(this); // == RegisterForMaster |
| 86 | auto *master = dynamic_cast<DVBChannel*>(s_master_map[m_key].front()); |
86 | 87 | if (master == this) |
87 | 88 | { |
88 | 89 | m_dvbCam = new DVBCam(m_device); |
… |
… |
DVBChannel::~DVBChannel() |
103 | 104 | // set a new master if there are other instances and we're the master |
104 | 105 | // whether we are the master or not remove us from the map.. |
105 | 106 | s_master_map_lock.lockForWrite(); |
106 | | QString key = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, m_device); |
107 | | if (m_pParent) |
108 | | key += QString(":%1") |
109 | | .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); |
110 | | auto *master = dynamic_cast<DVBChannel*>(s_master_map[key].front()); |
| 107 | auto *master = dynamic_cast<DVBChannel*>(s_master_map[m_key].front()); |
111 | 108 | if (master == this) |
112 | 109 | { |
113 | | s_master_map[key].pop_front(); |
| 110 | s_master_map[m_key].pop_front(); |
114 | 111 | DVBChannel *new_master = nullptr; |
115 | | if (!s_master_map[key].empty()) |
116 | | new_master = dynamic_cast<DVBChannel*>(s_master_map[key].front()); |
| 112 | if (!s_master_map[m_key].empty()) |
| 113 | new_master = dynamic_cast<DVBChannel*>(s_master_map[m_key].front()); |
117 | 114 | if (new_master) |
118 | 115 | { |
119 | 116 | QMutexLocker master_locker(&(master->m_hwLock)); |
… |
… |
DVBChannel::~DVBChannel() |
123 | 120 | } |
124 | 121 | else |
125 | 122 | { |
126 | | s_master_map[key].removeAll(this); |
| 123 | s_master_map[m_key].removeAll(this); |
127 | 124 | } |
128 | 125 | s_master_map_lock.unlock(); |
129 | 126 | |
… |
… |
DVBChannel::~DVBChannel() |
131 | 128 | |
132 | 129 | // if we're the last one out delete dvbcam |
133 | 130 | s_master_map_lock.lockForRead(); |
134 | | MasterMap::iterator mit = s_master_map.find(key); |
| 131 | MasterMap::iterator mit = s_master_map.find(m_key); |
135 | 132 | if ((*mit).empty()) |
136 | 133 | delete m_dvbCam; |
137 | 134 | m_dvbCam = nullptr; |
… |
… |
void DVBChannel::ReturnMasterLock(DVBChannel* &dvbm) |
1358 | 1355 | |
1359 | 1356 | DVBChannel *DVBChannel::GetMasterLock(void) const |
1360 | 1357 | { |
1361 | | QString key = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, m_device); |
1362 | | if (m_pParent) |
1363 | | key += QString(":%1") |
1364 | | .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); |
1365 | | DTVChannel *master = DTVChannel::GetMasterLock(key); |
| 1358 | DTVChannel *master = DTVChannel::GetMasterLock(m_key); |
1366 | 1359 | auto *dvbm = dynamic_cast<DVBChannel*>(master); |
1367 | 1360 | if (master && !dvbm) |
1368 | 1361 | DTVChannel::ReturnMasterLock(master); |
diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.h b/mythtv/libs/libmythtv/recorders/dvbchannel.h
index 2ce0898e4d..99caaabf3a 100644
a
|
b
|
class DVBChannel : public DTVChannel |
162 | 162 | // Other State |
163 | 163 | /// File descriptor for tuning hardware |
164 | 164 | int m_fdFrontend {-1}; |
165 | | QString m_device; ///< DVB Device |
| 165 | QString m_device; // DVB Device |
| 166 | QString m_key; // master lock key |
166 | 167 | /// true iff our driver munges PMT |
167 | 168 | bool m_hasCrcBug {false}; |
168 | 169 | |