summaryrefslogtreecommitdiff
path: root/plugins/oss
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-26 21:34:58 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-26 21:34:58 +0100
commitadebdd278b8e21e7ffeb107af0b3e25534edc796 (patch)
tree826f24088df473dcc5bbe62647f59817c40aa270 /plugins/oss
parent3ed2d21eddf76ebe1bf05d8624ff50598a1c8d28 (diff)
parent7262368b6897b41188f0cf6844ca875027d425a4 (diff)
Merge branch 'master' into devel
Conflicts: plugins/alsa/alsa.c streamer.c
Diffstat (limited to 'plugins/oss')
-rw-r--r--plugins/oss/oss.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c
index 64f857d3..9bd59c2a 100644
--- a/plugins/oss/oss.c
+++ b/plugins/oss/oss.c
@@ -48,7 +48,7 @@ static int state;
static int fd;
static uintptr_t mutex;
-#define BLOCKSIZE 4096
+#define BLOCKSIZE 8192
static void
oss_thread (void *context);
@@ -130,11 +130,10 @@ oss_init (void) {
static int
oss_change_rate (int rate) {
if (!fd) {
- oss_rate = rate;
return oss_rate;
}
if (rate == oss_rate) {
- trace ("oss_change_rate: same rate (%d), ignored\n", rate);
+ trace ("oss_change_rate: ignored\n", rate);
return rate;
}
deadbeef->mutex_lock (mutex);
@@ -241,7 +240,7 @@ oss_thread (void *context) {
if (oss_terminate) {
break;
}
- if (state != OUTPUT_STATE_PLAYING) {
+ if (state != OUTPUT_STATE_PLAYING || !deadbeef->streamer_ok_to_read (-1)) {
usleep (10000);
continue;
}
@@ -252,6 +251,7 @@ oss_thread (void *context) {
int res = write (fd, buf, sizeof (buf));
deadbeef->mutex_unlock (mutex);
if (res != sizeof (buf)) {
+ perror ("oss write");
fprintf (stderr, "oss: failed to write buffer\n");
}
usleep (1000); // this must be here to prevent mutex deadlock
@@ -260,10 +260,6 @@ oss_thread (void *context) {
static void
oss_callback (char *stream, int len) {
- if (!deadbeef->streamer_ok_to_read (len)) {
- memset (stream, 0, len);
- return;
- }
int bytesread = deadbeef->streamer_read (stream, len);
int16_t ivolume = deadbeef->volume_get_amp () * 1000;
for (int i = 0; i < bytesread/2; i++) {