diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-06-27 17:03:07 +0000 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-06-27 17:03:07 +0000 |
commit | 2a2c204cd0e4bcf0a603ba72be9a50203a817b54 (patch) | |
tree | 89877d800ecb1051ce27440c34524ec7cad1a961 /audio/pcm_bluetooth.c | |
parent | c205cc889023e733e56365e82dfbaad2d2b46942 (diff) |
Make storage to also save rfcomm channel, minor fixes to alsa plugin and fixes for service shutdown.
Diffstat (limited to 'audio/pcm_bluetooth.c')
-rw-r--r-- | audio/pcm_bluetooth.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c index 16c99f06..f95dcc9c 100644 --- a/audio/pcm_bluetooth.c +++ b/audio/pcm_bluetooth.c @@ -92,6 +92,9 @@ static void bluetooth_exit(struct bluetooth_data *data) if (data->sock >= 0) close(data->sock); + if (data->cfg.fd >= 0) + close(data->cfg.fd); + if (data->buffer) free(data->buffer); @@ -196,7 +199,7 @@ static snd_pcm_sframes_t bluetooth_read(snd_pcm_ioplug_t *io, proceed: buff = (unsigned char *) areas->addr + (areas->first + areas->step * offset) / 8; - if ((data->count + cfg.sample_size * size) <= cfg.pkt_len) + if ((data->count + size * frame_size) <= cfg.pkt_len) frames_to_write = size; else frames_to_write = (cfg.pkt_len - data->count) / frame_size; @@ -241,9 +244,9 @@ static snd_pcm_sframes_t bluetooth_write(snd_pcm_ioplug_t *io, buff = (uint8_t *) areas->addr + (areas->first + areas->step * offset) / 8; memcpy(data->buffer + data->count, buff, frame_size * frames_to_read); - if ((data->count + frames_to_read * frame_size) != cfg.pkt_len) { - /* Remember we have some frame in the pipe now */ - data->count += frames_to_read * frame_size; + /* Remember we have some frame in the pipe now */ + data->count += frames_to_read * frame_size; + if (data->count != cfg.pkt_len) { ret = frames_to_read; goto done; } |