Advertisement
jyavenard

Untitled

Dec 14th, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
  2. index 8dd1a67..70164a4 100644
  3. --- a/mythtv/libs/libmythtv/ringbuffer.cpp
  4. +++ b/mythtv/libs/libmythtv/ringbuffer.cpp
  5. @@ -40,6 +40,7 @@ const int RingBuffer::kDefaultOpenTimeout = 2000; // ms
  6. const int RingBuffer::kLiveTVOpenTimeout = 10000;
  7.  
  8. #define CHUNK 32768 /* readblocksize increments */
  9. +#define MAXBLOCK (256*1024) // Maximum buffer size
  10.  
  11. #define LOC QString("RingBuf(%1): ").arg(filename)
  12.  
  13. @@ -376,6 +377,7 @@ void RingBuffer::CalcReadAheadThresh(void)
  14. readblocksize = rbs;
  15. else
  16. readblocksize = max(rbs,readblocksize);
  17. + readblocksize = min(MAXBLOCK, readblocksize);
  18.  
  19. // minumum seconds of buffering before allowing read
  20. float secs_min = 0.35;
  21. @@ -820,6 +822,8 @@ void RingBuffer::run(void)
  22. int old_block_size = readblocksize;
  23. readblocksize = 3 * readblocksize / 2;
  24. readblocksize = ((readblocksize+CHUNK-1) / CHUNK) * CHUNK;
  25. + readblocksize = min(MAXBLOCK, readblocksize);
  26. +
  27. LOG(VB_FILE, LOG_INFO, LOC +
  28. QString("Avg read interval was %1 msec. "
  29. "%2K -> %3K block size")
  30. @@ -838,6 +842,7 @@ void RingBuffer::run(void)
  31. .arg((readblocksize+CHUNK)/1024)
  32. .arg(readblocksize/1024));
  33. readtimeavg = 225;
  34. + readblocksize = min(MAXBLOCK, readblocksize);
  35. }
  36. }
  37. ignore_for_read_timing = (totfree < readblocksize) ? true : false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement