From patchwork Sun May 8 14:48:50 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 11869 Received: from tiger.cadsoft.de ([217.7.101.210]) by www.linuxtv.org with esmtp (Exim 4.34) id 1DUn5T-0006Ca-L6 for vdr@linuxtv.org; Sun, 08 May 2005 16:48:55 +0200 Received: from raven.cadsoft.de (raven.cadsoft.de [217.7.101.211]) by tiger.cadsoft.de (8.12.7/8.12.7) with ESMTP id j48EmsMC030402 for ; Sun, 8 May 2005 16:48:55 +0200 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.12.7/8.12.7) with ESMTP id j48EmrXY023697 for ; Sun, 8 May 2005 16:48:53 +0200 Message-ID: <427E26D2.4010601@cadsoft.de> Date: Sun, 08 May 2005 16:48:50 +0200 From: Klaus Schmidinger Organization: CadSoft Computer GmbH User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en MIME-Version: 1.0 To: vdr@linuxtv.org Subject: Re: [vdr] Re: [PATCH] Hang when moving between editing marks References: <4D516C3CF4%linux@youmustbejoking.demon.co.uk> <427D0B81.7080605@gmx.de> <427E1BBB.2090503@cadsoft.de> <200505081631.30994.sebastian@schnapsleichen.de> <427E2432.5020201@cadsoft.de> In-Reply-To: <427E2432.5020201@cadsoft.de> 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: Sun, 08 May 2005 14:48:55 -0000 Status: O X-Status: X-Keywords: X-UID: 2019 Klaus Schmidinger wrote: > Sebastian Frei wrote: > >> I applied the patch, but it doesn't work as good as the sched_yield >> "patch". >> >> Now it takes between 3 and 8 seconds when moving or jumping between >> cutmarks, with the sched_yield this was possible instantly. > > > What happens if you put a > > cCondWait::SleepMs(1); > > instead of the sched_yield()? > Maybe Reinhards remark about putting the sleep() outside of the locked area > is the key... > > Klaus Here's another suggestion (line numbers may be a little off). The only difference to Reinhard's patch is that the sleep is done outside the locked area. Klaus --- dvbplayer.c 2005/01/14 14:00:56 1.30 +++ dvbplayer.c 2005/05/08 14:40:48 @@ -370,9 +372,14 @@ nonBlockingFileReader = new cNonBlockingFileReader; int Length = 0; + bool Sleep = false; running = true; while (running && (NextFile() || readIndex >= 0 || ringBuffer->Available() || !DeviceFlush(100))) { + if (Sleep) { + cCondWait::SleepMs(3); // this keeps the CPU load low + Sleep = false; + } cPoller Poller; if (DevicePoll(Poller, 100)) { @@ -380,8 +387,8 @@ // Read the next frame from the file: - if (!readFrame && (replayFile >= 0 || readIndex >= 0)) { - if (playMode != pmStill) { + if (playMode != pmStill && playMode != pmPause) { + if (!readFrame && (replayFile >= 0 || readIndex >= 0)) { if (!nonBlockingFileReader->Reading()) { if (playMode == pmFast || (playMode == pmSlow && playDir == pdBackward)) { uchar FileNumber; @@ -438,16 +445,16 @@ break; } } - else - cCondWait::SleepMs(3); // this keeps the CPU load low - } - // Store the frame in the buffer: + // Store the frame in the buffer: - if (readFrame) { - if (ringBuffer->Put(readFrame)) - readFrame = NULL; + if (readFrame) { + if (ringBuffer->Put(readFrame)) + readFrame = NULL; + } } + else + Sleep = true; // Get the next frame from the buffer: