Skip to content

Commit

Permalink
Fixes #9864. Make sure we wake up any sleepers the when we change fro…
Browse files Browse the repository at this point in the history
…m the !readsallowed to the readsallowed state.

This usually happens implicitly simply due to the differences in the size of various buffers and read sizes. But that is a bit fragile and complicates tuning buffer sizes for better overall performance.

If you are experiencing the same timeout problem Jim Stichnoth has been experiencing, this should noticably improve your myth:// streaming performance.
  • Loading branch information
daniel-kristjansson committed Jun 24, 2011
1 parent 39646ba commit 5db2d56
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/ringbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ void RingBuffer::run(void)

int used = bufferSize - ReadBufFree();

bool reads_were_allowed = readsallowed;

if ((0 == read_return) || (numfailures > 5) ||
(readsallowed != (used >= fill_min || ateof ||
setswitchtonext || commserror)))
Expand Down Expand Up @@ -909,7 +911,7 @@ void RingBuffer::run(void)
else
{
// yield if we have nothing to do...
if (!request_pause &&
if (!request_pause && reads_were_allowed &&
(used >= fill_threshold || ateof || setswitchtonext))
{
generalWait.wait(&rwlock, 50);
Expand Down

0 comments on commit 5db2d56

Please sign in to comment.