From 9e5e2eaec398ba6c390a3395222dff11c0b7b49d Mon Sep 17 00:00:00 2001 From: Eduard Hasenleithner Date: Sun, 5 Aug 2001 19:04:34 +0000 Subject: Fixed a very hard to track bug with 5.0 or 5.1 playback: If gaps need to be written, the former size of 8192 was not a multiple of the sample*channels size. This is explained as forbidden in the OSS programmer's guide. The new zero_buffer is a multiple of 3 and 5 (along the many 2s). CVS patchset: 390 CVS date: 2001/08/05 19:04:34 --- src/audio_out/audio_oss_out.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 364c50049..6b5d2f57d 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.25 2001/08/05 12:19:54 ehasenle Exp $ + * $Id: audio_oss_out.c,v 1.26 2001/08/05 19:04:34 ehasenle Exp $ */ /* required for swab() */ @@ -74,6 +74,9 @@ #define AUDIO_NUM_FRAGMENTS 15 #define AUDIO_FRAGMENT_SIZE 8192 +/* bufsize must be a multiple of 3 and 5 for 5.0 and 5.1 channel playback! */ +#define ZERO_BUF_SIZE 15360 + #define GAP_TOLERANCE 5000 #define MAX_GAP 90000 @@ -301,10 +304,10 @@ static void ao_fill_gap (oss_functions_t *this, uint32_t pts_len) { this->bytes_in_buffer += num_bytes; - while (num_bytes>0) { - if (num_bytes>8192) { - write(this->audio_fd, this->zero_space, 8192); - num_bytes -= 8192; + while (num_bytes > 0) { + if (num_bytes > ZERO_BUF_SIZE) { + write(this->audio_fd, this->zero_space, ZERO_BUF_SIZE); + num_bytes -= ZERO_BUF_SIZE; } else { write(this->audio_fd, this->zero_space, num_bytes); num_bytes = 0; @@ -690,8 +693,8 @@ ao_functions_t *init_audio_out_plugin (config_values_t *config) { this->sample_buffer = malloc (40000); memset (this->sample_buffer, 0, 40000); - this->zero_space = malloc (8192); - memset (this->zero_space, 0, 8192); + this->zero_space = malloc (ZERO_BUF_SIZE); + memset (this->zero_space, 0, ZERO_BUF_SIZE); this->ao_functions.get_capabilities = ao_get_capabilities; this->ao_functions.get_property = ao_get_property; -- cgit v1.2.3