From d2177eebb17eec2af91c26480d36435102c41db1 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Thu, 21 Jan 2010 20:15:52 +0100 Subject: oss buffer tweaks; fixed streamer error handling --- plugins/oss/oss.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'plugins/oss') diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c index b8602cf7..06eb5a78 100644 --- a/plugins/oss/oss.c +++ b/plugins/oss/oss.c @@ -47,7 +47,8 @@ static int oss_rate = 44100; static int state; static int fd; static uintptr_t mutex; -static int blksize; + +#define BLOCKSIZE 4096 static void oss_thread (void *context); @@ -120,14 +121,6 @@ oss_init (void) { trace ("oss: samplerate: %d\n", oss_rate); -// audio_buf_info bi; -// ioctl (fd, SNDCTL_DSP_GETOSPACE, &bi); -// trace ("oss: bi.bytes=%d, bi.fragsize=%d, bi.fragstotal=%d\n", bi.bytes, bi.fragsize, bi.fragstotal); -// blksize = bi.fragsize; - - ioctl (fd, SNDCTL_DSP_GETBLKSIZE, &blksize); - trace ("oss: blksize: %d\n", blksize); - mutex = deadbeef->mutex_create (); oss_tid = deadbeef->thread_start (oss_thread, NULL); @@ -181,7 +174,9 @@ oss_free (void) { static int oss_play (void) { if (!oss_tid) { - oss_init (); + if (oss_init () < 0) { + return -1; + } } state = OUTPUT_STATE_PLAYING; return 0; @@ -251,7 +246,7 @@ oss_thread (void *context) { continue; } - char buf[blksize]; + char buf[BLOCKSIZE]; oss_callback (buf, sizeof (buf)); deadbeef->mutex_lock (mutex); int res = write (fd, buf, sizeof (buf)); -- cgit v1.2.3