[pitivi] previewers: Clarify WAVEFORMS_CPU_USAGE usage



commit 88cd41755d389adf3bf87392c96e384da1541d42
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Dec 12 18:48:55 2013 +0100

    previewers: Clarify WAVEFORMS_CPU_USAGE usage

 pitivi/timeline/previewers.py |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 8865d03..6f78bb8 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -674,17 +674,18 @@ class PipelineCpuAdapter(Loggable):
         self.lastMoment = datetime.now()
         self.lastUsage = resource.getrusage(resource.RUSAGE_SELF)
 
-        if usage_percent >= WAVEFORMS_CPU_USAGE and self.rate < 0.1:
-            if not self.ready:
-                self.ready = True
-                self.pipeline.set_state(Gst.State.READY)
-                res, self.lastPos = self.pipeline.query_position(Gst.Format.TIME)
-            return True
-
-        if usage_percent >= WAVEFORMS_CPU_USAGE and self.rate > 0.0:
-            self.rate *= 0.9
-            self.log('Pipeline rate slowed down (-10%%) to %.3f' % self.rate)
-        elif usage_percent < WAVEFORMS_CPU_USAGE:
+        if usage_percent >= WAVEFORMS_CPU_USAGE:
+            if self.rate < 0.1:
+                if not self.ready:
+                    self.ready = True
+                    self.pipeline.set_state(Gst.State.READY)
+                    res, self.lastPos = self.pipeline.query_position(Gst.Format.TIME)
+                return True
+
+            if self.rate > 0.0:
+                self.rate *= 0.9
+                self.log('Pipeline rate slowed down (-10%%) to %.3f' % self.rate)
+        else:
             self.rate *= 1.1
             self.log('Pipeline rate sped up (+10%%) to %.3f' % self.rate)
 


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