From 0db2f30f3dd423f8ed008b6e239d63c36e5ebe71 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 17 Mar 2012 12:58:11 +0100 Subject: [PATCH] zapit: add workaround for SPARK driver problems the h264 decoder seems to not like running out of data, so if the frontend looses lock, the player2 driver might crash workaround for now is to stop the video decoder if the lock is lost --- src/zapit/include/zapit/frontend_c.h | 5 +++-- src/zapit/src/zapit.cpp | 29 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index 77ebd4d41..4cef5c1b2 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -92,8 +92,6 @@ class CFrontend /* current frontend instance */ static CFrontend *currentFe; bool locked; - /* tuning finished flag */ - bool tuned; /* information about the used frontend type */ struct dvb_frontend_info info; /* current 22kHz tone mode */ @@ -157,6 +155,9 @@ class CFrontend friend class CFEManager; public: + /* tuning finished flag */ + bool tuned; + ~CFrontend(void); static CFrontend *getInstance(int Number = 0, int Adapter = 0); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index d4cabc5e2..c81bb2623 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2068,6 +2068,9 @@ void CZapit::run() #if 0 time_t stime = time(0); time_t curtime; +#endif +#if HAVE_SPARK_HARDWARE + bool v_stopped = false; #endif printf("[zapit] starting... tid %ld\n", syscall(__NR_gettid)); @@ -2103,7 +2106,33 @@ void CZapit::run() SendEvent(CZapitClient::EVT_PMT_CHANGED, &channel_id, sizeof(channel_id)); } } +#if HAVE_SPARK_HARDWARE + /* hack: stop videodecoder if the tuner looses lock + * at least the h264 decoder seems unhappy if he runs out of data... + * ...until we fix the driver, let's work around it here. + * theoretically, a "retune()" function could also be implemented here + * for the case that the driver cannot re-lock the tuner (DiSEqC problem, + * unicable collision, .... */ + if (CFrontend::getInstance()->tuned) + { + if (!CFrontend::getInstance()->getStatus() && !v_stopped) + { + fprintf(stderr, "[zapit] LOST LOCK! stopping video...\n"); + videoDecoder->Stop(false); + v_stopped = true; + } + else if (CFrontend::getInstance()->getStatus()) + { + if (v_stopped) + { + fprintf(stderr, "[zapit] reacquired LOCK! starting video...\n"); + videoDecoder->Start(); + } + v_stopped = false; + } } +#endif + } /* yuck, don't waste that much cpu time :) */ usleep(0); #if 0