From patchwork Tue May 17 22:44:17 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Burgess X-Patchwork-Id: 11884 Received: from mail3.uklinux.net ([80.84.72.33]) by www.linuxtv.org with esmtp (Exim 4.34) id 1DYAo2-00064W-Tk for vdr@linuxtv.org; Wed, 18 May 2005 00:44:54 +0200 Received: from [194.247.51.171] (bts-0939.dialup.zetnet.co.uk [194.247.51.171]) by mail3.uklinux.net (Postfix) with ESMTP id 8611B409FB4 for ; Tue, 17 May 2005 22:44:47 +0000 (UTC) Message-ID: <428A73C1.7040204@uklinux.net> Date: Tue, 17 May 2005 23:44:17 +0100 From: Jon Burgess User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Klaus Schmidinger's VDR Subject: Re: [vdr] VDR+DXR3 - stability problems (possible patch) References: <007801c557bb$356b4310$ab04020a@hmtutak2> <1116009320.14907.83.camel@bobcat.mine.nu> <4284FE2D.2050702@uklinux.net> <4287B0A2.70901@iki.fi> <4288DF93.6020509@nixz.net> In-Reply-To: <4288DF93.6020509@nixz.net> X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2005 22:44:55 -0000 Status: O X-Status: X-Keywords: X-UID: 2295 Mikolaj Tutak wrote: > Yes, I have this. Menu shows mixed trashes (swaped lines etc.) and VDR > hangs for long time. Maybe I take snapshot some time. Yes this occasional freeze with garbled OSD happens from time to time and seems to be much more frequent when there is no Video data (e.g. with the mp3 plugin). I don't know any way of fixing these problems. I've been working on the problems that occur with occasional bursts of interference which can occasionally cause the output to lockup. I've made a few changes which seem to help a lot with getting the dxr3plugin to recover when this occurs. Can you try adding this patch to the dxr3plugin and see if it helps? Jon diff --exclude='*.o' -urw /home/jburgess/dvb/vdr-1.3.23/PLUGINS/src/dxr3/dxr3demuxdevice.c dxr3/dxr3demuxdevice.c --- /home/jburgess/dvb/vdr-1.3.23/PLUGINS/src/dxr3/dxr3demuxdevice.c 2005-04-19 19:19:37.000000000 +0100 +++ dxr3/dxr3demuxdevice.c 2005-05-17 22:36:39.000000000 +0100 @@ -396,6 +396,9 @@ m_dxr3Device.SetVerticalSize(pesFrame.GetVerticalSize()); while (!Poll(100)); cFixedLengthFrame* pTempFrame = m_vBuf.Push(pesFrame.GetEsStart(), (int) (pesFrame.GetEsLength()), pts, ftVideo); + + if (!pTempFrame) /* Push Timeout */ + throw (cDxr3PesFrame::PES_GENERAL_ERROR); pTempFrame->SetAspectRatio(pesFrame.GetAspectRatio()); m_aBuf.WakeUp(); @@ -422,6 +425,10 @@ m_dxr3Device.SetHorizontalSize(pesFrame.GetHorizontalSize()); m_dxr3Device.SetVerticalSize(pesFrame.GetVerticalSize()); cFixedLengthFrame* pTempFrame = m_vBuf.Push(pesFrame.GetEsStart(), (int) (pesFrame.GetEsLength()), pts, ftVideo); + + if (!pTempFrame) /* Push Timeout */ + throw (cDxr3PesFrame::PES_GENERAL_ERROR); + pTempFrame->SetAspectRatio(pesFrame.GetAspectRatio()); if (m_synchState == DXR3_DEMUX_AUDIO_SYNCHED) diff -urw ref-/dxr3/dxr3outputthread.c dxr3/dxr3outputthread.c --- ref-/dxr3/dxr3outputthread.c 2005-04-19 19:19:38.000000000 +0100 +++ dxr3/dxr3outputthread.c 2005-05-08 03:04:21.000000000 +0100 @@ -95,10 +95,12 @@ sched_param temp; temp.sched_priority = 2; +#if 0 if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp)) { cLog::Instance() << "cDxr3AudioOutThread::Action(): Error can't set priority\n"; } +#endif while (!GetStopSignal()) { @@ -189,12 +191,12 @@ sched_param temp; temp.sched_priority = 1; - +#if 0 if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp)) { cLog::Instance() << "cDxr3VideoOutThread::Action(): Error can't set priority\n"; } - +#endif while (!GetStopSignal()) { cFixedLengthFrame* pNext = m_buffer.Get(); diff -urw ref-/dxr3/dxr3syncbuffer.c dxr3/dxr3syncbuffer.c --- ref-/dxr3/dxr3syncbuffer.c 2005-04-19 19:19:38.000000000 +0100 +++ dxr3/dxr3syncbuffer.c 2005-05-17 22:37:52.000000000 +0100 @@ -26,6 +26,7 @@ */ #include +#include #include "dxr3syncbuffer.h" #include "dxr3memcpy.h" @@ -174,15 +175,17 @@ } // ================================== -const int BUFFER_LIMIT = 5; -const int BUFFER_LIMIT_2 = 10; +const int BUFFER_LIMIT = 5; // 5 +const int BUFFER_LIMIT_2 = 10; // 10 // ================================== bool cDxr3SyncBuffer::Poll(int TimeoutMs) { bool retVal = true; uint32_t currTime = m_dxr3Device.GetSysClock(); + struct timeval tv_start, tv; m_bPollSync = true; + gettimeofday(&tv_start, NULL); if (m_demuxMode == DXR3_DEMUX_REPLAY_MODE) { if (Available() >= Size() - (Size()*BUFFER_LIMIT/100)) @@ -192,10 +195,20 @@ ((m_dxr3Device.GetSysClock() - currTime) < ((uint32_t)TimeoutMs * (uint32_t)45))) { + int d_s, d_us, ms; m_bPutBlock = true; EnableGet(); m_bWaitPts = false; WaitForPut(); + gettimeofday(&tv, NULL); + d_s = tv.tv_sec - tv_start.tv_sec; + d_us = tv.tv_usec - tv_start.tv_usec; + ms = d_s * 1000 + d_us / 1000; + if (ms > TimeoutMs * 2) { + cLog::Instance() << "Secondary timeout\n"; + printf("Secondary timeout\n"); + break; + } } if (Available() >= Size() - (Size()*BUFFER_LIMIT_2)/100) { @@ -211,6 +224,8 @@ cFixedLengthFrame* cDxr3SyncBuffer::Push(const uint8_t* pStart, int length, uint32_t pts, eFrameType type) throw (eSyncBufferException) { int lastIndex = 0; + struct timeval tv_start, tv; + gettimeofday(&tv_start, NULL); switch (m_demuxMode) { @@ -223,10 +238,21 @@ while ((Available() >= Size() - (Size()*10)/100)) { + int d_s, d_us, ms; m_bPutBlock = true; EnableGet(); m_bWaitPts = false; WaitForPut(); + gettimeofday(&tv, NULL); + d_s = tv.tv_sec - tv_start.tv_sec; + d_us = tv.tv_usec - tv_start.tv_usec; + ms = d_s * 1000 + d_us / 1000; + if (ms > 2000) { + cLog::Instance() << "Push timeout\n"; + printf("Push timeout\n"); + return NULL; + //break; + } } #if VDRVERSNUM < 10313