summaryrefslogtreecommitdiff
path: root/plugins/oss
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-21 20:15:52 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-21 20:15:52 +0100
commitd2177eebb17eec2af91c26480d36435102c41db1 (patch)
tree026299866f4537d96417be53d77a41297b328e8b /plugins/oss
parentcf8e4015b3ef777b9fe1526eae7f4431116109ee (diff)
oss buffer tweaks; fixed streamer error handling
Diffstat (limited to 'plugins/oss')
-rw-r--r--plugins/oss/oss.c17
1 files changed, 6 insertions, 11 deletions
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));