summaryrefslogtreecommitdiff
path: root/src/input/net_buf_ctrl.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-03 00:38:22 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-03 00:38:22 +0200
commit0ed2cd4f34189ec303dfac5a30de0abae0decba8 (patch)
tree7a8d08d25ca7c81daa9d6cd65fd4f633fd676b41 /src/input/net_buf_ctrl.c
parent6081bc9a06ee97333769f77a9e5c18a15afb29da (diff)
parent3dd7d925c2feb7868a49e7a1a0b953a5aab233f0 (diff)
downloadxine-lib-0ed2cd4f34189ec303dfac5a30de0abae0decba8.tar.gz
xine-lib-0ed2cd4f34189ec303dfac5a30de0abae0decba8.tar.bz2
Merge changes happened in 1.1 development.
Diffstat (limited to 'src/input/net_buf_ctrl.c')
-rw-r--r--src/input/net_buf_ctrl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c
index 75743a070..86514cdea 100644
--- a/src/input/net_buf_ctrl.c
+++ b/src/input/net_buf_ctrl.c
@@ -149,7 +149,7 @@ static void nbc_compute_fifo_length(nbc_t *this,
fifo_buffer_t *fifo,
buf_element_t *buf,
int action) {
- int fifo_free, fifo_fill;
+ int fifo_free, fifo_fill, fifo_div;
int64_t video_br, audio_br, diff;
int has_video, has_audio;
@@ -160,10 +160,13 @@ static void nbc_compute_fifo_length(nbc_t *this,
fifo_free = fifo->buffer_pool_num_free;
fifo_fill = fifo->fifo_size;
+ fifo_div = fifo_fill + fifo_free - 1;
+ if (fifo_div == 0)
+ fifo_div = 1; /* avoid a possible divide-by-zero */
if (fifo == this->video_fifo) {
this->video_fifo_free = fifo_free;
- this->video_fifo_fill = (100 * fifo_fill) / (fifo_fill + fifo_free - 1);
+ this->video_fifo_fill = (100 * fifo_fill) / fifo_div;
this->video_fifo_size = fifo->fifo_data_size;
if (buf->pts && (this->video_in_disc == 0)) {
@@ -196,7 +199,7 @@ static void nbc_compute_fifo_length(nbc_t *this,
} else {
this->audio_fifo_free = fifo_free;
- this->audio_fifo_fill = (100 * fifo_fill) / (fifo_fill + fifo_free - 1);
+ this->audio_fifo_fill = (100 * fifo_fill) / fifo_div;
this->audio_fifo_size = fifo->fifo_data_size;
if (buf->pts && (this->audio_in_disc == 0)) {