All pastes #2074278 Raw Edit

Someone

public text v1 · immutable
#2074278 ·published 2011-06-03 21:23 UTC
rendered paste body
diff --git a/mythtv/libs/libmythtv/dbcheck.cpp b/mythtv/libs/libmythtv/dbcheck.cpp
index 297dc6d..347a7d5 100644
--- a/mythtv/libs/libmythtv/dbcheck.cpp
+++ b/mythtv/libs/libmythtv/dbcheck.cpp
@@ -21,7 +21,7 @@ using namespace std;
    mythtv/bindings/perl/MythTV.pm
 */
 /// This is the DB schema version expected by the running MythTV instance.
-const QString currentDatabaseVersion = "1276";
+const QString currentDatabaseVersion = "1275";
 
 static bool UpdateDBVersionNumber(const QString &newnumber, QString &dbver);
 static bool performActualUpdate(
diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
index d588131..1d8223d 100644
--- a/mythtv/libs/libmythtv/ringbuffer.cpp
+++ b/mythtv/libs/libmythtv/ringbuffer.cpp
@@ -1253,24 +1253,31 @@ uint64_t RingBuffer::UpdateDecoderRate(uint64_t latest)
     static QTime midnight = QTime(0, 0, 0);
     QTime now = QTime::currentTime();
     qint64 age = midnight.msecsTo(now);
-    qint64 oldest = age - 1000;
+    qint64 too_old = age - 1000;
+    qint64 oldest = age, newest = 0;
+
 
     decoderReadLock.lock();
+    if (latest)
+        decoderReads.insert(age, latest);
+
     uint64_t total = 0;
     QMutableMapIterator<qint64,uint64_t> it(decoderReads);
     while (it.hasNext())
     {
         it.next();
-        if (it.key() < oldest || it.key() > age)
+        if (it.key() < too_old || it.key() > age)
             it.remove();
         else
+        {
+            oldest = min(oldest, it.key());
+            newest = max(newest, it.key());
             total += it.value();
+        }
     }
 
-    if (latest)
-        decoderReads.insert(age, latest);
-
-    uint64_t average = (uint64_t)((double)total * 8.0);
+    uint64_t average = (newest > oldest) ?
+        (uint64_t)((double)total * 8000.0) / (newest - oldest) : 0;
     decoderReadLock.unlock();
 
     VERBOSE(VB_FILE, LOC + QString("Decoder read speed: %1 %2")