neutrino: stop EIT read before zap

This commit is contained in:
[CST] Focus
2014-09-02 12:59:21 +04:00
parent cac3a87137
commit 3513f9830a
8 changed files with 41 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ struct sectionsd
getIsScanningActive, // commandGetIsScanningActive
getIsTimeSet, // commandGetIsTimeSet
serviceChanged, // commandserviceChanged
serviceStopped, // commandserviceChanged
CMD_registerEvents, // commandRegisterEventClient
CMD_unregisterEvents, // commandUnRegisterEventClient
freeMemory, // commandFreeMemory

View File

@@ -161,6 +161,14 @@ void CSectionsdClient::setServiceChanged(const t_channel_id channel_id, const bo
close_connection();
}
void CSectionsdClient::setServiceStopped()
{
send(sectionsd::serviceStopped);
readResponse();
close_connection();
}
void CSectionsdClient::freeMemory()
{
send(sectionsd::freeMemory);

View File

@@ -182,6 +182,7 @@ class CSectionsdClient : private CBasicClient
bool getIsTimeSet();
void setPauseScanning(const bool doPause);
void setServiceChanged(const t_channel_id channel_id, const bool requestEvent, int dnum = 0);
void setServiceStopped();
bool getIsScanningActive();

View File

@@ -119,6 +119,8 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
//printf("[neutrino] timeout EVT_ZAP current %llx data %llx\n", current_channel_id, *(t_channel_id *)data);
if ((*(t_channel_id *)data) != current_channel_id) {
g_InfoViewer->chanready = 0;
if (!IS_WEBTV(current_channel_id))
g_Sectionsd->setServiceStopped();
CMoviePlayerGui::getInstance().stopPlayBack();
g_Zapit->zapTo_serviceID_NOWAIT(current_channel_id );
//g_Sectionsd->setServiceChanged(current_channel_id, false);
@@ -702,6 +704,8 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s
g_RCInput->killTimer(scrambled_timer);
//dvbsub_pause(true);
CZapit::getInstance()->Abort();
if (!IS_WEBTV(channel_id))
g_Sectionsd->setServiceStopped();
CMoviePlayerGui::getInstance().stopPlayBack();
g_Zapit->zapTo_serviceID_NOWAIT(channel_id);

View File

@@ -73,7 +73,6 @@ DMX::DMX()
void DMX::init()
{
fd = -1;
lastChanged = time_monotonic();
filter_index = 0;
real_pauseCounter = 0;
@@ -124,7 +123,6 @@ void DMX::closefd(void)
//dmx->Stop();
delete dmx;
dmx = NULL;
fd = -1;
}
}
@@ -283,6 +281,10 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout
}
lock();
if (!isOpen()) {
unlock();
return -1;
}
int rc = dmx->Read(buf, MAX_SECTION_LENGTH, timeoutInMSeconds);
@@ -492,7 +494,6 @@ int DMX::immediate_start(void)
dmx = new cDemux(dmx_num);
dmx->Open(DMX_PSI_CHANNEL, NULL, dmxBufferSizeInKB*1024UL);
}
fd = 1;
/* setfilter() only if this is no dummy filter... */
if (filters[filter_index].filter && filters[filter_index].mask)

View File

@@ -53,7 +53,6 @@ class DMX
{
protected:
int fd;
cDemux * dmx;
int dmx_num;
unsigned short pID;
@@ -69,7 +68,7 @@ protected:
bool seen_section;
inline bool isOpen(void) {
return (fd != -1);
return (dmx != NULL);
}
int immediate_start(void); /* mutex must be locked before and unlocked after this method */

View File

@@ -260,6 +260,7 @@ class CCNThread : public CEventsThread
void sendCNEvent();
public:
CCNThread();
void stopUpdate();
bool checkUpdate();
};

View File

@@ -968,6 +968,20 @@ static void commandserviceChanged(int connfd, char *data, const unsigned dataLen
dprintf("[sectionsd] commandserviceChanged: Service changed to " PRINTF_CHANNEL_ID_TYPE "\n", uniqueServiceKey);
}
static void commandserviceStopped(int connfd, char * /* data */, const unsigned /* dataLength */)
{
xprintf("[sectionsd] commandserviceStopped\n");
sendEmptyResponse(connfd, NULL, 0);
threadCN.lock();
threadEIT.lock();
threadCN.closefd();
threadEIT.closefd();
threadCN.unlock();
threadEIT.unlock();
threadCN.stopUpdate();
xprintf("[sectionsd] commandserviceStopped done\n");
}
static void commandGetIsScanningActive(int connfd, char* /*data*/, const unsigned /*dataLength*/)
{
struct sectionsd::msgResponseHeader responseHeader;
@@ -1233,6 +1247,7 @@ static s_cmd_table connectionCommands[sectionsd::numberOfCommands] = {
{ commandGetIsScanningActive, "commandGetIsScanningActive" },
{ commandGetIsTimeSet, "commandGetIsTimeSet" },
{ commandserviceChanged, "commandserviceChanged" },
{ commandserviceStopped, "commandserviceStopped" },
{ commandRegisterEventClient, "commandRegisterEventClient" },
{ commandUnRegisterEventClient, "commandUnRegisterEventClient" },
{ commandFreeMemory, "commandFreeMemory" },
@@ -1786,7 +1801,7 @@ void CCNThread::beforeWait()
update_mutex.unlock();
}
void CCNThread::afterWait()
void CCNThread::stopUpdate()
{
xprintf("%s: stop eit update filter (%s)\n", name.c_str(), updating ? "active" : "not active");
update_mutex.lock();
@@ -1797,6 +1812,11 @@ void CCNThread::afterWait()
update_mutex.unlock();
}
void CCNThread::afterWait()
{
stopUpdate();
}
void CCNThread::beforeSleep()
{
if (sendToSleepNow && messaging_have_CN == 0x00) {