summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2003-10-04 14:36:05 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2003-10-04 14:36:05 +0000
commit80640de72078beb50796ff28d068dfd085299b86 (patch)
treefd0350b2a0ddc01efa16a5ba3b1e450d16353895
parent9327936ad79a1dd588dd41310186594f5e13989e (diff)
downloadxine-lib-80640de72078beb50796ff28d068dfd085299b86.tar.gz
xine-lib-80640de72078beb50796ff28d068dfd085299b86.tar.bz2
Fix a deadlock.
Patch from Ramon van der Aar <rvda@itsec-ps.nl> CVS patchset: 5434 CVS date: 2003/10/04 14:36:05
-rw-r--r--src/input/net_buf_ctrl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c
index 0138f1234..eb4ee3894 100644
--- a/src/input/net_buf_ctrl.c
+++ b/src/input/net_buf_ctrl.c
@@ -284,8 +284,12 @@ static void nbc_put_cb (fifo_buffer_t *fifo,
* - high_water_mark is reached by all fifos
* do not restart if has_video and has_audio are false to avoid
* a yoyo effect at the beginning of the stream when these values
- * are not yet known. */
- if ((fifo->buffer_pool_num_free <= 1) ||
+ * are not yet known.
+ *
+ * be sure that the next buffer_pool_alloc() call will not deadlock,
+ * we need at least 2 buffers (see buffer.c)
+ */
+ if ((fifo->buffer_pool_num_free <= 2) ||
(((!has_video) || (this->video_fifo_length > this->high_water_mark)) &&
((!has_audio) || (this->audio_fifo_length > this->high_water_mark)) &&
(has_video || has_audio))) {
@@ -362,7 +366,7 @@ static void nbc_get_cb (fifo_buffer_t *fifo,
/* Don't pause if the other fifo is full because the next
put() will restart the engine */
- if (other_fifo_free > 1) {
+ if (other_fifo_free > 2) {
this->buffering = 1;
this->progress = 0;
report_progress (this->stream, 0);