summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/oss/oss.c17
-rw-r--r--streamer.c5
2 files changed, 10 insertions, 12 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));
diff --git a/streamer.c b/streamer.c
index 3a29866f..0d6c85c8 100644
--- a/streamer.c
+++ b/streamer.c
@@ -308,7 +308,10 @@ streamer_thread (void *ctx) {
else if (pstate == 1) {
last_bitrate = -1;
avg_bitrate = -1;
- p_play ();
+ if (p_play () < 0) {
+ fprintf (stderr, "streamer: failed to start playback; output plugin doesn't work\n");
+ streamer_set_nextsong (-2, 0);
+ }
}
else if (pstate == 2) {
p_pause ();