X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/56881ef900d55ee6056b0c4d9dd9954e950ca32e..75db34c299094d2ae87941ed464e8efa79848e16:/lib/dvb/dvb.cpp diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 18765ad3..09c9f5f6 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -282,9 +282,14 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtrm_inuse) && ((!fe) || (i->m_adapter == fe->m_adapter))) + { + int is_decode = n < 2; + + int in_use = is_decode ? (i->m_demux->getRefCount() != 2) : i->m_inuse; + + if ((!in_use) && ((!fe) || (i->m_adapter == fe->m_adapter))) { - if ((cap & iDVBChannel::capDecode) && (n >= 2)) + if ((cap & iDVBChannel::capDecode) && !is_decode) continue; demux = new eDVBAllocatedDemux(i); @@ -294,6 +299,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtrget().setSourcePVR(0); return 0; } + } eDebug("demux not found"); return -1; } @@ -530,7 +536,11 @@ bool eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, con if (i->m_channel_id == ignore) { eDVBChannel *channel = (eDVBChannel*) &(*i->m_channel); - if (channel == &(*m_cached_channel) ? channel->getUseCount() == 2 : channel->getUseCount() == 1) // channel only used once.. + // one eUsePtr is used in eDVBServicePMTHandler + // another on eUsePtr is used in the eDVBScan instance used in eDVBServicePMTHandler (for SDT scan) + // so we must check here if usecount is 3 (when the channel is equal to the cached channel) + // or 2 when the cached channel is not equal to the compared channel + if (channel == &(*m_cached_channel) ? channel->getUseCount() == 3 : channel->getUseCount() == 2) // channel only used once.. { ePtr fe; if (!i->m_channel->getFrontend(fe))