Fix bug: 100% CPU use during playback.

This commit is contained in:
Johns 2012-06-30 15:40:33 +02:00
parent d486fb2ca1
commit b5162bae5c
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@ User johns
Date:
Release Version 0.5.1
Fix bug: 100% CPU use during playback.
Fix bug: audio use 100% CPU during pause.
Guard audio skip against old PTS values.
Improved audio skip, after channel switch.

View File

@ -2181,10 +2181,15 @@ int Poll(int timeout)
#else
int full;
int t;
int used;
int filled;
// one buffer is full
full = AudioFreeBytes() < AUDIO_MIN_BUFFER_FREE
|| atomic_read(&VideoPacketsFilled) > VIDEO_PACKET_MAX - 3;
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;