From 9a6ae4095428babb9981a8dcd884dd38860bacda Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Fri, 28 Mar 2014 19:53:22 +0200 Subject: [PATCH] Optimized the startup delay. --- device.c | 6 ++++-- device.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/device.c b/device.c index 09055ab..7c59fbb 100644 --- a/device.c +++ b/device.c @@ -19,7 +19,9 @@ cSatipDevice::cSatipDevice(unsigned int indexP) isPacketDeliveredM(false), isOpenDvrM(false), deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)), - channelM() + channelM(), + createdM(0), + mutexM() { unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE; bufsize -= (bufsize % TS_SIZE); @@ -147,7 +149,7 @@ cString cSatipDevice::GetInformation(unsigned int pageP) bool cSatipDevice::Ready(void) { //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); - return (cSatipDiscover::GetInstance()->GetServerCount() > 0); + return ((cSatipDiscover::GetInstance()->GetServerCount() > 0) || (createdM.Elapsed() > eReadyTimeoutMs)); } cString cSatipDevice::DeviceType(void) const diff --git a/device.h b/device.h index 0514448..53c7873 100644 --- a/device.h +++ b/device.h @@ -26,6 +26,9 @@ public: // private parts private: + enum { + eReadyTimeoutMs = 2000 // in milliseconds + }; unsigned int deviceIndexM; bool isPacketDeliveredM; bool isOpenDvrM; @@ -34,6 +37,7 @@ private: cRingBufferLinear *tsBufferM; cSatipTuner *pTunerM; cSatipSectionFilterHandler *pSectionFilterHandlerM; + cTimeMs createdM; cMutex mutexM; // constructor & destructor