Skip to content

Commit

Permalink
Revert "merge streamrelay related things with pli"
Browse files Browse the repository at this point in the history
This reverts commit 72275c3.

I can't tell why but timerecordings are crashing at isPlayable.

PC: 000d1464
Fault Address: 00000000
Error Code:: 519
Backtrace:
./enigma2(_Z17handleFatalSignaliP9siginfo_tPv) [0xA77B0]
/lib/libc.so.6(__default_rt_sa_restorer) [0xB5F08EC0]
./enigma2(_ZN11eDVBService10isPlayableERK17eServiceReferenceS2_b) [0xD1464]
./enigma2(n/a) [0x1C3154]
  • Loading branch information
teamblue-e2 committed Feb 9, 2024
1 parent 65ee6fb commit d07f7ed
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 61 deletions.
20 changes: 2 additions & 18 deletions lib/dvb/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <dvbsi++/satellite_delivery_system_descriptor.h>
#include <dvbsi++/s2_satellite_delivery_system_descriptor.h>
#include <dirent.h>
#include <lib/nav/core.h>

/*
* Copyright (C) 2017 Marcus Metzler <[email protected]>
Expand Down Expand Up @@ -222,35 +221,20 @@ bool eDVBService::isCrypted()

int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate)
{
eServiceReferenceDVB sRelayOrigSref;
ePtr<iPlayableService> refCur;
eNavigation::getInstance()->getCurrentService(refCur);
ePtr<iServiceInformation> tmp_info;
refCur->info(tmp_info);
std::string ref_s = tmp_info->getInfoString(iServiceInformation::sServiceref);
eServiceReferenceDVB currentlyPlaying = eServiceReferenceDVB(ref_s);
bool res = currentlyPlaying.getSROriginal(sRelayOrigSref);

ePtr<eDVBResourceManager> res_mgr;
bool remote_fallback_enabled = eConfigManager::getConfigBoolValue("config.usage.remote_fallback_enabled", false);

if (eDVBResourceManager::getInstance(res_mgr))
eDebug("[eDVBService] isPlayble... no res manager!!");
else
{
eDVBChannelID chid, chid_ignore, chid_ignore_sr;
eDVBChannelID chid, chid_ignore;
int system;

((const eServiceReferenceDVB&)ref).getChannelID(chid);
((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore);

if (res) {
sRelayOrigSref.getChannelID(chid_ignore_sr);
} else {
chid_ignore_sr = eDVBChannelID();
}

if (res_mgr->canAllocateChannel(chid, chid_ignore, chid_ignore_sr, system, simulate))
if (res_mgr->canAllocateChannel(chid, chid_ignore, system, simulate))
{
bool use_ci_assignment = eConfigManager::getConfigBoolValue("config.misc.use_ci_assignment", false);
if (use_ci_assignment)
Expand Down
20 changes: 3 additions & 17 deletions lib/dvb/dvb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <linux/dvb/dmx.h>
#include <linux/dvb/version.h>

#include <lib/base/cfile.h>
#include <lib/base/eerror.h>
#include <lib/base/estring.h>
#include <lib/base/wrappers.h>
Expand Down Expand Up @@ -1434,17 +1435,16 @@ int tuner_type_channel_default(ePtr<iDVBChannelList> &channellist, const eDVBCha
return 0;
}

int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore, const eDVBChannelID& ignoresr, int &system, bool simulate)
int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore, int &system, bool simulate)
{
std::list<active_channel> &active_channels = simulate ? m_active_simulate_channels : m_active_channels;
int ret = 0;
system = iDVBFrontend::feSatellite;
if (!simulate && m_cached_channel)
{
eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel);
if(channelid==cache_chan->getChannelID()) {
if(channelid==cache_chan->getChannelID())
return tuner_type_channel_default(m_list, channelid, system);
}
}

/* first, check if a channel is already existing. */
Expand All @@ -1466,7 +1466,6 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
std::vector<int*> fcc_decremented_fe_usecounts;
std::map<eDVBChannelID, int> fcc_chids;
int apply_to_ignore = 0;
int apply_to_ignoresr = 0;
if (!eFCCServiceManager::getFCCChannelID(fcc_chids))
{
for (std::map<eDVBChannelID, int>::iterator i(fcc_chids.begin()); i != fcc_chids.end(); ++i)
Expand Down Expand Up @@ -1513,18 +1512,6 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
}
}

// For stream relayed channel make a check is it in the available channels and if it is ignore it
if (ignoresr) {
for (std::list<active_channel>::iterator i(active_channels.begin()); i != active_channels.end(); ++i)
{
if (i->m_channel_id == ignoresr)
{
apply_to_ignoresr = 1;
break;
}
}
}

for (std::list<active_channel>::iterator i(active_channels.begin()); i != active_channels.end(); ++i)
{
eSmartPtrList<eDVBRegisteredFrontend> &frontends = simulate ? m_simulate_frontend : m_frontend;
Expand All @@ -1538,7 +1525,6 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
// or 2 when the cached channel is not equal to the compared channel
int check_usecount = channel == &(*m_cached_channel) ? 1 : 0;
check_usecount += (apply_to_ignore+1) * 2; // one is used in eDVBServicePMTHandler and another is used in eDVBScan.
check_usecount += apply_to_ignoresr;
//eDebug("[eDVBResourceManager] canAllocateChannel channel->getUseCount() : %d , check_usecount : %d (cached : %d)", channel->getUseCount(), check_usecount, channel == &(*m_cached_channel));
if (channel->getUseCount() == check_usecount) // channel only used once..(except fcc)
{
Expand Down
3 changes: 2 additions & 1 deletion lib/dvb/dvb.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class eDVBResourceManager: public iObject, public sigc::trackable
ePtr<iDVBChannelList> m_list;
ePtr<iDVBSatelliteEquipmentControl> m_sec;
static eDVBResourceManager *instance;

friend class eDVBChannel;
friend class eFBCTunerManager;
ePtr<eFBCTunerManager> m_fbcmng;
Expand Down Expand Up @@ -215,7 +216,7 @@ class eDVBResourceManager: public iObject, public sigc::trackable
};

RESULT connectChannelAdded(const sigc::slot1<void,eDVBChannel*> &channelAdded, ePtr<eConnection> &connection);
int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore, const eDVBChannelID& ignoresr, int &system, bool simulate=false);
int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore, int &system, bool simulate=false);

/* allocate channel... */
RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool simulate=false);
Expand Down
12 changes: 9 additions & 3 deletions lib/dvb/pmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@
#include <dvbsi++/application_descriptor.h>

#define PACK_VERSION(major,minor,micro) (((major) << 16) + ((minor) << 8) + (micro))
#define UNPACK_VERSION(version,major,minor,micro) { \
major = (version)&0xff; \
minor = (version>>8)&0xff; \
micro = (version>>16)&0xff; \
}

eDVBServicePMTHandler::eDVBServicePMTHandler()
:m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF), m_no_pat_entry_delay(eTimer::create())
:m_last_channel_state(-1), m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF),
m_no_pat_entry_delay(eTimer::create()), m_have_cached_program(false)
{
m_use_decode_demux = 0;
m_pmt_pid = -1;
Expand Down Expand Up @@ -524,7 +530,7 @@ PyObject *eDVBServicePMTHandler::getHbbTVApplications()

int eDVBServicePMTHandler::getProgramInfo(program &program)
{
ePtr<eTable<ProgramMapSection> > ptr;
// ePtr<eTable<ProgramMapSection> > ptr;
int cached_apid_ac3 = -1;
int cached_apid_ac4 = -1;
int cached_apid_ddp = -1;
Expand Down Expand Up @@ -1127,7 +1133,7 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, ePtr<iTsSource> &s
if (isStreamRelay) {
sRelayOrigSref.getChannelID(chid);
res = m_resourceManager->allocateChannel(chid, m_sr_channel, simulate);
}
}


if (m_sr_channel) {
Expand Down
33 changes: 11 additions & 22 deletions lib/service/servicedvb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int eStaticServiceDVBInformation::isPlayable(const eServiceReference &ref, const
int system;
((const eServiceReferenceDVB&)ref).getChannelID(chid);
((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore);
return res_mgr->canAllocateChannel(chid, chid_ignore, eDVBChannelID(), system);
return res_mgr->canAllocateChannel(chid, chid_ignore, system);
}
return 0;
}
Expand Down Expand Up @@ -251,7 +251,7 @@ int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref
};
int system;
((const eServiceReferenceDVB&)*it).getChannelID(chid);
int tmp = res->canAllocateChannel(chid, chid_ignore, eDVBChannelID(), system, simulate);
int tmp = res->canAllocateChannel(chid, chid_ignore, system, simulate);
if (prio_order == 127) // ignore dvb-type priority, try all alternatives one-by-one
{
if (((tmp > 0) || (!it->path.empty())))
Expand Down Expand Up @@ -403,7 +403,7 @@ int eStaticServiceDVBPVRInformation::getLength(const eServiceReference &ref)

/* check if cached data is still valid */
if (m_parser.m_data_ok && (s.st_size == m_parser.m_filesize) && (m_parser.m_length))
return m_parser.m_length / 90000;
return (int)(m_parser.m_length / 90000);

/* open again, this time with stream info */
if (tstools.openFile(ref.path.c_str()))
Expand All @@ -423,7 +423,7 @@ int eStaticServiceDVBPVRInformation::getLength(const eServiceReference &ref)
m_parser.m_length = len;
m_parser.m_filesize = s.st_size;
m_parser.updateMeta(ref.path);
return m_parser.m_length / 90000;
return (int)(m_parser.m_length / 90000);
}

int eStaticServiceDVBPVRInformation::getInfo(const eServiceReference &ref, int w)
Expand Down Expand Up @@ -638,7 +638,9 @@ RESULT eDVBPVRServiceOfflineOperations::reindex()
int result;
/* Release global interpreter lock */
Py_BEGIN_ALLOW_THREADS;
result = reindex_work(m_ref.path.c_str());
{
result = reindex_work(m_ref.path.c_str());
}
Py_END_ALLOW_THREADS;
return result;
}
Expand Down Expand Up @@ -2038,20 +2040,8 @@ std::string eDVBServicePlay::getInfoString(int w)
switch (w)
{
case sProvider:
{
if (!m_dvb_service) return "";
std::string prov = m_dvb_service->m_provider_name;
if (prov.empty()) {
eServiceReferenceDVB sRelayOrigSref;
bool res = ((const eServiceReferenceDVB&)m_reference).getSROriginal(sRelayOrigSref);
if (res) {
ePtr<eDVBService> sRelayServiceOrigSref;
eDVBDB::getInstance()->getService(sRelayOrigSref, sRelayServiceOrigSref);
return sRelayServiceOrigSref->m_provider_name;
}
}
return prov;
}
return m_dvb_service->m_provider_name;
case sServiceref:
return m_reference.toString();
case sHBBTVUrl:
Expand Down Expand Up @@ -2240,8 +2230,8 @@ int eDVBServicePlay::selectAudioStream(int i)

int rdsPid = apid;

/* if we are not in PVR mode, timeshift is not active and we are not in pip mode, check if we need to enable the rds reader */
if (!(m_timeshift_active || m_decoder_index || m_have_video_pid || !m_is_primary))
/* if we are not in PVR mode, timeshift is not active and we are not in pip mode, check if we need to enable the rds reader */
if (!(m_is_pvr || m_timeshift_active || m_decoder_index || m_have_video_pid || !m_is_primary))
{
int different_pid = program.videoStreams.empty() && program.audioStreams.size() == 1 && program.audioStreams[stream].rdsPid != -1;
if (different_pid)
Expand Down Expand Up @@ -2404,8 +2394,7 @@ bool eDVBServiceBase::tryFallbackTuner(eServiceReferenceDVB &service, bool &is_s
return false;
service.getChannelID(chid); // this sets chid
eServiceReferenceDVB().getChannelID(chid_ignore); // this sets chid_ignore

if(res_mgr->canAllocateChannel(chid, chid_ignore, eDVBChannelID(), system)) // this sets system
if(res_mgr->canAllocateChannel(chid, chid_ignore, system)) // this sets system
return false;

if (eConfigManager::getConfigBoolValue("config.usage.remote_fallback_alternative", false) && !(system == iDVBFrontend::feSatellite))
Expand Down

0 comments on commit d07f7ed

Please sign in to comment.