diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-07-02 18:20:55 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-07-02 18:20:55 +0000 |
commit | 27efcd4c911f473f94ef89eb13c7c996412df5ee (patch) | |
tree | d6fac5a58354f981be7bb57778f22b09a1c0424e /src | |
parent | e0c92e551aeb2f386091be36445333c9892b1c4b (diff) | |
download | xine-lib-27efcd4c911f473f94ef89eb13c7c996412df5ee.tar.gz xine-lib-27efcd4c911f473f94ef89eb13c7c996412df5ee.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/input/input_pvr.c | 16 |
1 files changed, 10 insertions, 6 deletions
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:/<prefix_to_tmp_files>\!<prefix_to_saved_files>\!<max_page_age> * - * $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 ) { |