From 87db48cae2e7875af646327143e09e1c4cd230ad Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Tue, 23 Feb 2010 21:58:55 +0000 Subject: Prevent discard_{frames,buffers} from going negative. Based on patches from Roger Scott . --- src/xine-engine/audio_out.c | 5 ++++- src/xine-engine/video_out.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 4f68b8975..985520759 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1889,8 +1889,11 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value /* recursive discard buffers setting */ if(value) this->discard_buffers++; - else + else if (this->discard_buffers) this->discard_buffers--; + else + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "ao_set_property: discard_buffers is already zero\n"); ret = this->discard_buffers; diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 0b6d8f7a1..d06e82afa 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -1469,8 +1469,11 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value pthread_mutex_lock(&this->display_img_buf_queue->mutex); if(value) this->discard_frames++; - else + else if (this->discard_frames) this->discard_frames--; + else + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "vo_set_property: discard_frames is already zero\n"); pthread_mutex_unlock(&this->display_img_buf_queue->mutex); ret = this->discard_frames; -- cgit v1.2.3