All pastes #2075377 Raw Edit

Anonymous

public text v1 · immutable
#2075377 ·published 2011-06-06 04:23 UTC
rendered paste body
diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
index b0df928..13518eb 100644
--- a/mythtv/libs/libmythtv/ringbuffer.cpp
+++ b/mythtv/libs/libmythtv/ringbuffer.cpp
@@ -732,8 +732,7 @@ void RingBuffer::run(void)
 
         // These are conditions where we don't want to go through
         // the loop if they are true.
-        if (((totfree < readblocksize) && readsallowed) ||
-            (ignorereadpos >= 0) || commserror || stopreads)
+        if ((ignorereadpos >= 0) || commserror || stopreads)
         {
             ignore_for_read_timing |=
                 (ignorereadpos >= 0) || commserror || stopreads;
@@ -750,12 +749,16 @@ void RingBuffer::run(void)
             totfree = ReadBufFree();
         }
 
+        const uint KB32  =  32*1024;
         int read_return = -1;
-        if (totfree >= readblocksize && !commserror &&
+        if (totfree >= KB32 && !commserror &&
             !ateof && !setswitchtonext)
         {
             // limit the read size
-            totfree = readblocksize;
+            if (readblocksize > totfree)
+                totfree = (int)(totfree / KB32) * KB32; // must be multiple of 32KB
+            else
+                totfree = readblocksize;
 
             // adapt blocksize
             gettimeofday(&now, NULL);
diff --git a/mythtv/programs/mythmediaserver/mythmediaserver b/mythtv/programs/mythmediaserver/mythmediaserver
index 31ee00c..ad0aab5 100755
Binary files a/mythtv/programs/mythmediaserver/mythmediaserver and b/mythtv/programs/mythmediaserver/mythmediaserver differ