From 27efcd4c911f473f94ef89eb13c7c996412df5ee Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 2 Jul 2003 18:20:55 +0000 Subject: fix unreleased mutex, also some reordering to guarantee consistency of play_blk/play_page CVS patchset: 5122 CVS date: 2003/07/02 18:20:55 --- src/input/input_pvr.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 3e2eacdb7..08f9dcae0 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/\!\! * - * $Id: input_pvr.c,v 1.26 2003/06/29 21:56:17 miguelfreitas Exp $ + * $Id: input_pvr.c,v 1.27 2003/07/02 18:20:55 miguelfreitas Exp $ */ /************************************************************************** @@ -714,6 +714,12 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t if( this->rec_fd == -1 ) return 1; + if(speed != XINE_SPEED_PAUSE) { + /* cannot run faster than the writing thread */ + while( this->play_blk >= this->rec_blk-1 ) + pthread_cond_wait (&this->has_valid_data, &this->lock); + } + if( this->play_fd == -1 || ((this->play_blk - this->page_block[this->play_page]) >= BLOCKS_PER_PAGE) || (this->rec_page > this->play_page && this->play_blk >= this->page_block[this->play_page+1]) ) { @@ -764,10 +770,6 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t } if(speed != XINE_SPEED_PAUSE) { - - /* cannot run faster than the writing thread */ - while( this->play_blk >= this->rec_blk-1 ) - pthread_cond_wait (&this->has_valid_data, &this->lock); pos = (off_t)(this->play_blk - this->page_block[this->play_page]) * PVR_BLOCK_SIZE; if( lseek (this->play_fd, pos, SEEK_SET) != pos ) { @@ -1222,8 +1224,10 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff pthread_mutex_lock(&this->lock); if( this->pvr_playing ) - if( !pvr_play_file(this, fifo, buf->content, speed) ) + if( !pvr_play_file(this, fifo, buf->content, speed) ) { + pthread_mutex_unlock(&this->lock); return NULL; + } if( todo == PVR_BLOCK_SIZE && speed != XINE_SPEED_PAUSE && this->pvr_playing ) { -- cgit v1.2.3