summaryrefslogtreecommitdiff
path: root/softhddev.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-06-30 15:40:33 +0200
committerJohns <johns98@gmx.net>2012-06-30 15:40:33 +0200
commitb5162bae5c0afc83f70dcc4ce1eb6dd77bad8559 (patch)
tree0da783170b38d6be207ba68dc57663be873e7ef8 /softhddev.c
parentd486fb2ca1e27fa66a52dcf60506cba6d9d464d2 (diff)
downloadvdr-plugin-softhddevice-b5162bae5c0afc83f70dcc4ce1eb6dd77bad8559.tar.gz
vdr-plugin-softhddevice-b5162bae5c0afc83f70dcc4ce1eb6dd77bad8559.tar.bz2
Fix bug: 100% CPU use during playback.
Diffstat (limited to 'softhddev.c')
-rw-r--r--softhddev.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/softhddev.c b/softhddev.c
index b45b198..57858ed 100644
--- a/softhddev.c
+++ b/softhddev.c
@@ -2181,10 +2181,15 @@ int Poll(int timeout)
#else
int full;
int t;
-
- // one buffer is full
- full = AudioFreeBytes() < AUDIO_MIN_BUFFER_FREE
- || atomic_read(&VideoPacketsFilled) > VIDEO_PACKET_MAX - 3;
+ int used;
+ int filled;
+
+ used = AudioUsedBytes();
+ filled = atomic_read(&VideoPacketsFilled);
+ // soft limit + hard limit
+ full = (used > AUDIO_MIN_BUFFER_FREE && filled > 3)
+ || AudioFreeBytes() < AUDIO_MIN_BUFFER_FREE
+ || filled >= VIDEO_PACKET_MAX - 3;
if (!full || !timeout) {
return !full;