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: Date:
Release Version 0.5.1 Release Version 0.5.1
Fix bug: 100% CPU use during playback.
Fix bug: audio use 100% CPU during pause. Fix bug: audio use 100% CPU during pause.
Guard audio skip against old PTS values. Guard audio skip against old PTS values.
Improved audio skip, after channel switch. Improved audio skip, after channel switch.

View File

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