diff options
author | Eduard Hasenleithner <ehasenle@users.sourceforge.net> | 2001-08-05 19:04:34 +0000 |
---|---|---|
committer | Eduard Hasenleithner <ehasenle@users.sourceforge.net> | 2001-08-05 19:04:34 +0000 |
commit | 9e5e2eaec398ba6c390a3395222dff11c0b7b49d (patch) | |
tree | 912f0ae83ec681618a054a15a3c50d4f276f6bfd /src | |
parent | 7e26b4f6fcc783b9a1af8525cbef5924b78bc135 (diff) | |
download | xine-lib-9e5e2eaec398ba6c390a3395222dff11c0b7b49d.tar.gz xine-lib-9e5e2eaec398ba6c390a3395222dff11c0b7b49d.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/audio_out/audio_oss_out.c | 17 |
1 files changed, 10 insertions, 7 deletions
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; |