Permalink
Browse files

Reduce # number DeviceReadBuffer::Read() calls.

Refs #11252.

This reduces the number of reads per second we make in the stream handlers
utilizing the DRB. It does this by waiting 20 ms for at least dev_read_size
bytes rather than 500 ms for min_read bytes. The device reads are larger
than the minimum read so this actually results in waiting a bit longer
under normal conditions while returning more quickly when we're not getting
data from the device. A win-win.
  • Loading branch information...
1 parent 75e5530 commit 6912383b2c0c59df12aa9c8af521200fbe4e585d @daniel-kristjansson daniel-kristjansson committed Jan 2, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 mythtv/libs/libmythtv/recorders/DeviceReadBuffer.cpp
@@ -625,7 +625,7 @@ bool DeviceReadBuffer::CheckForErrors(
*/
uint DeviceReadBuffer::Read(unsigned char *buf, const uint count)
{
- uint avail = WaitForUsed(min(count, (uint)min_read), 500);
+ uint avail = WaitForUsed(min(count, (uint)dev_read_size), 20);
size_t cnt = min(count, avail);
if (!cnt)

0 comments on commit 6912383

Please sign in to comment.