On Fri, Feb 02, 2007 at 10:26:33PM +0200, Marko Mäkelä wrote:
> I fixed the long-standing bug with the suspend function of softdevice.
> If softdevice is suspended when playing back a recording, the recording
> will fast-forward to the end.  This patch modifies softdevice so that
> it will block the data stream from vdr when playing back recordings.
> 
> This fix is now also included in my softdevice patch for Udo Richter's
> shutdown rewrite:
> 
> http://www.iki.fi/~msmakela/software/vdr/#shutdown
> http://www.iki.fi/~msmakela/software/vdr/shutdown-softdevice.patch
> 
> The attached patch is simpler, as it only fixes this bug.  Please apply it.

Sorry, the patch causes 100% CPU load when softdevice is suspended.  Adding
a usleep(10000) drops the load to less than 1% on my system.  I first tried
usleep(100000), but it caused vdr to hang for a long time.  I updated the
patch on my home page.  Below are the hunks that fix this bug only.

        Marko

Index: softdevice.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/softdevice.c,v
retrieving revision 1.77
diff -p -u -r1.77 softdevice.c
--- softdevice.c        28 Jan 2007 19:38:06 -0000      1.77
+++ softdevice.c        7 Feb 2007 17:30:19 -0000
@@ -525,6 +534,10 @@ int cSoftDevice::PlayAudio(const uchar *
 # endif
 {
   SOFTDEB("PlayAudio... %p length %d\n",Data,Length);
+  if (setupStore.shouldSuspend && !Transferring()) {
+    usleep(10000); // avoid burning CPU
+    return 0;
+  }
   if (! packetMode)
     return decoder->Decode(Data, Length);
 
@@ -580,6 +593,10 @@ int  cSoftDevice::GetAudioChannelDevice(
 int cSoftDevice::PlayVideo(const uchar *Data, int Length)
 {
    SOFTDEB("PlayVideo %x length %d\n",Data,Length);
+  if (setupStore.shouldSuspend && !Transferring()) {
+    usleep(10000); // avoid burning CPU
+    return 0;
+  }
    if (! packetMode)
     return decoder->Decode(Data, Length);
_______________________________________________
Softdevice-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/softdevice-devel

Reply via email to