Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] CPU savings when not viewing



hello,

I think it could be useful to stop showing the picture for soft replay
(to save CPU cycles and power) when VDR is not used for actual
viewing, but it is e.g. recording.  I think this has come up on this
list earlier, also.

As a first try, I made the following changes to vdr.c:

added a new variable in main()
  bool Playing = true; 

and then the following (some surroundings also provided for context):

        eKeys key = Interface->GetKey(!Interact ||
        !Interact->NeedsFastResponse());
        if (NORMALKEY(key) != kNone) {
           EITScanner.Activity();
           LastActivity = time(NULL);
           // Restart playing after freeze
           if (Playing != true) {
             cDevice::PrimaryDevice()->Play();
             Playing = true; 
           } 
        } 
        if ((LastActivity > 0) && (Playing == true) && (time(NULL) -
        LastActivity > 60)) {
          // Stop showing the channel to reduce processor load on
        softdevices
          cDevice::PrimaryDevice()->Freeze(); 
          Playing = false; 
        } 
        // Keys that must work independent of any interactive mode:
        switch (key) { 
      
Here, for testing purposes only, the timeout is only 60s.

Problem 1: the LastActivity variable is actually used for two
purposes: for timeouts and to see if the session is interactive or
something.  So implemented this way, the timeout is only effective
after a user has done some interactivity.  If the (LastActivity > 0)
condition is removed, the system starts with the image off, and
pressing e.g. OK is required to get the image in the first place.

Problem 2: at least for xine-plugin this does not seem to free any
resources, since Freeze() shows a still image and the plugin or
something else seems to use a lot of cycles in doing something.
(something definitely changes, vmstat shows approx 40% us 60% sy when
in Freeze and 60% us 40% sy when playing) I did
not find other calls that would seem working.  Suggestions?

BTW: the constructor of cTransfer is public even if there is a
controlling class for this class, too.

yours,
		Jouni




Home | Main Index | Thread Index