From f5befe8ab54b797a0a5357ceddf2f05ab0ff163c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 24 Oct 2007 14:21:06 +0000 Subject: Revert buffer contraints patch (it wasn't doing what was intended and it actually caused errors for applications in some cases) --- audio/pcm_bluetooth.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c index 2131e9ea..6f9bbe0b 100644 --- a/audio/pcm_bluetooth.c +++ b/audio/pcm_bluetooth.c @@ -46,8 +46,7 @@ #define MIN_PERIOD_TIME 1 -#define MIN_BUFFER_SIZE 256 /* minimum size of buffer */ -#define MAX_BUFFER_SIZE 16384 /* allocated RAM for buffer */ +#define BUFFER_SIZE 2048 #ifdef ENABLE_DEBUG #define DBG(fmt, arg...) printf("DEBUG: %s: " fmt "\n" , __FUNCTION__ , ## arg) @@ -71,7 +70,7 @@ struct bluetooth_a2dp { sbc_t sbc; /* Codec data */ int codesize; /* SBC codesize */ int samples; /* Number of encoded samples */ - uint8_t buffer[MAX_BUFFER_SIZE];/* Codec transfer buffer */ + uint8_t buffer[BUFFER_SIZE]; /* Codec transfer buffer */ int count; /* Codec transfer buffer counter */ int nsamples; /* Cumulative number of codec samples */ @@ -85,7 +84,7 @@ struct bluetooth_data { struct ipc_data_cfg cfg; /* Bluetooth device config */ struct pollfd stream; /* Audio stream filedescriptor */ struct pollfd server; /* Audio daemon filedescriptor */ - uint8_t buffer[MAX_BUFFER_SIZE];/* Encoded transfer buffer */ + uint8_t buffer[BUFFER_SIZE]; /* Encoded transfer buffer */ int count; /* Transfer buffer counter */ struct bluetooth_a2dp a2dp; /* A2DP data */ @@ -893,22 +892,12 @@ static int bluetooth_a2dp_hw_constraint(snd_pcm_ioplug_t *io) err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES, a2dp->codesize, - MAX_BUFFER_SIZE / 2); + a2dp->codesize); if (err < 0) return err; - /* supported buffer sizes */ - err = snd_pcm_ioplug_set_param_minmax(io, - SND_PCM_IOPLUG_HW_BUFFER_BYTES, - MIN_BUFFER_SIZE, - MAX_BUFFER_SIZE); - if (err < 0) - return err; - - /* supported period count: - * - derived from max buffer size and minimum period size */ err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS, - 2, MAX_BUFFER_SIZE / a2dp->codesize); + 2, 50); if (err < 0) return err; -- cgit