Skip to content

Commit

Permalink
Reduce # number DeviceReadBuffer::Read() calls.
Browse files Browse the repository at this point in the history
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
daniel-kristjansson committed Jan 2, 2013
1 parent 75e5530 commit 6912383
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/DeviceReadBuffer.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 6912383

Please sign in to comment.