summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Stembridge <jstembridge@users.sourceforge.net>2003-04-21 00:25:55 +0000
committerJames Stembridge <jstembridge@users.sourceforge.net>2003-04-21 00:25:55 +0000
commit95d4429819392486db8acb4fda7249b3c8c4a290 (patch)
tree51ea84d4ecad7981a4bb1e3a6feec1971d50b2a4 /src
parentd4f2f43dfe8ba0af7db9b10eba6fb42fd03a61fa (diff)
downloadxine-lib-95d4429819392486db8acb4fda7249b3c8c4a290.tar.gz
xine-lib-95d4429819392486db8acb4fda7249b3c8c4a290.tar.bz2
driver might get closed while filling gap so check it is open before writing
CVS patchset: 4645 CVS date: 2003/04/21 00:25:55
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/audio_out.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 9a58c159f..11bd7b698 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.122 2003/04/20 21:13:21 guenter Exp $
+ * $Id: audio_out.c,v 1.123 2003/04/21 00:25:55 jstembridge Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -391,12 +391,16 @@ static void write_pause_burst(aos_t *this, uint32_t num_frames) {
while (num_frames > 1536) {
if(num_frames > 1536) {
pthread_mutex_lock( &this->driver_lock );
- this->driver->write(this->driver, sbuf, 1536);
+ if(this->driver_open) {
+ this->driver->write(this->driver, sbuf, 1536);
+ num_frames -= 1536;
+ } else
+ num_frames = 0;
pthread_mutex_unlock( &this->driver_lock );
- num_frames -= 1536;
} else {
pthread_mutex_lock( &this->driver_lock );
- this->driver->write(this->driver, sbuf, num_frames);
+ if(this->driver_open)
+ this->driver->write(this->driver, sbuf, num_frames);
pthread_mutex_unlock( &this->driver_lock );
num_frames = 0;
}
@@ -428,12 +432,16 @@ static void ao_fill_gap (aos_t *this, int64_t pts_len) {
while (num_frames > 0 && !this->discard_buffers) {
if (num_frames > ZERO_BUF_SIZE) {
pthread_mutex_lock( &this->driver_lock );
- this->driver->write(this->driver, this->zero_space, ZERO_BUF_SIZE);
+ if(this->driver_open) {
+ this->driver->write(this->driver, this->zero_space, ZERO_BUF_SIZE);
+ num_frames -= ZERO_BUF_SIZE;
+ } else
+ num_frames = 0;
pthread_mutex_unlock( &this->driver_lock );
- num_frames -= ZERO_BUF_SIZE;
} else {
pthread_mutex_lock( &this->driver_lock );
- this->driver->write(this->driver, this->zero_space, num_frames);
+ if(this->driver_open)
+ this->driver->write(this->driver, this->zero_space, num_frames);
pthread_mutex_unlock( &this->driver_lock );
num_frames = 0;
}