From patchwork Fri May 13 19:21:17 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jon Burgess X-Patchwork-Id: 11874 Received: from mail3.uklinux.net ([80.84.72.33]) by www.linuxtv.org with esmtp (Exim 4.34) id 1DWgHP-0005hy-QN for vdr@linuxtv.org; Fri, 13 May 2005 21:57:03 +0200 Received: from [194.247.51.246] (bts-1014.dialup.zetnet.co.uk [194.247.51.246]) by mail3.uklinux.net (Postfix) with ESMTP id EC98C409FBC for ; Fri, 13 May 2005 19:23:22 +0000 (UTC) Message-ID: <4284FE2D.2050702@uklinux.net> Date: Fri, 13 May 2005 20:21:17 +0100 From: Jon Burgess User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) 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> In-Reply-To: <1116009320.14907.83.camel@bobcat.mine.nu> 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: Fri, 13 May 2005 19:57:03 -0000 Status: O X-Status: X-Keywords: X-UID: 2179 Ville Skyttä wrote: > On Fri, 2005-05-13 at 14:56 +0200, Mikolaj Tutak wrote: > > >>But the only solution is to stop VDR (sometimes it requires kill -9) and >>load it again. Dou you know any solution/workaround for this? Maybe other >>combination of DXR3 plugin/driver versions? > > > http://sf.net/mailarchive/forum.php?thread_id=7212515&forum_id=7173 > > Someone reported on em8300-devel that removing pthread_setschedparam() > calls from both VDR and the DXR3 plugin helped with similar problems in > his setup. > Removing the pthread_setschedparam() helps to prevent a complete lockup in my setup. Unfortunately the soft lockups which require the "kill -9" still occur. The patch attached seems to help, but hasn't had much testing. The patch attached also seems to help the plugin recover more gracefully when it gets some bad data. It still needs some more work because sometimes the stream still needs to be manually stopped and restarted to resume playback (but at least it does stop instead, rather than locking up vdr). I think the problem that this patch helps address is that the dvbplayer thread gets stuck waiting for the flush to finish and the main VDR thread cancels it. Unfortunately the thread sometimes holds a lock on the dxr3syncbuffer and this stops the video output thread. With the patch applied, the flush returns and thread exits before the 3 second thread cancel timeout. Jon --- dxr3/dxr3syncbuffer.c.~1.1.2.8.~ 2005-04-19 19:19:38.000000000 +0100 +++ dxr3/dxr3syncbuffer.c 2005-05-13 00:28:34.000000000 +0100 @@ -26,6 +26,7 @@ */ #include +#include #include "dxr3syncbuffer.h" #include "dxr3memcpy.h" @@ -182,7 +183,9 @@ { 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,20 @@ 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"); + break; + } } #if VDRVERSNUM < 10313