| Summary: | SDL_OpenAudioDevice always returns half the samples requested. | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Alain Dupuis <adupuis5000> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | vincent.hamp |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
Was this with PulseAudio? ALSA? Something else? --ryan. This is with PulseAudio. This is because of the PA_STREAM_ADJUST_LATENCY code in SDL_pulseaudio.c Since revision 10757:329d6d46fb90 I now get the same number of samples as requested. Not sure if it's the desired effect since it still has the PA_STREAM_ADJUST_LATENCY check in SDL_pulseaudio.c. Just thought I'd let you know. Otherwise, good work on that commit! (In reply to Alain Dupuis from comment #4) > Since revision 10757:329d6d46fb90 I now get the same number of samples as > requested. Not sure if it's the desired effect since it still has the > PA_STREAM_ADJUST_LATENCY check in SDL_pulseaudio.c. Just thought I'd let you > know. Otherwise, good work on that commit! Yeah, SDL now buffers between what the app wants to feed the device, and what the device wants to be fed, so it works out better for everyone. :) Marking this resolved! --ryan. I was just about to file a new bug when I found this entry. I'm getting the very same behavior explained in the entry post with 2.0.12 and pulseaudio 13.0. freq 44100 44100 format AUDIO_S16LSB AUDIO_S16LSB channels 4 4 silence 0 0 samples 256 128 padding 0 0 size 0 1024 freq 44100 44100 format AUDIO_S16LSB AUDIO_S16LSB channels 2 2 silence 0 0 samples 256 128 padding 0 0 size 0 512 freq 44100 44100 format AUDIO_S16LSB AUDIO_S16LSB channels 1 1 silence 0 0 samples 256 128 padding 0 0 size 0 256 freq 22050 22050 format AUDIO_U8 AUDIO_U8 channels 2 2 silence 0 128 samples 256 128 padding 0 0 size 0 256 freq 22050 22050 format AUDIO_U8 AUDIO_U8 channels 1 1 silence 0 128 samples 256 128 padding 0 0 size 0 128 I just found out that the bug only occurs when there are two structures passed to SDL_OpenAudio. Passing only the desired spec seems to work. |
Whenever I compare the values requested with what obtained I always get half of the samples requested. I tried changing the number of channels, freq, and format to see if this happen with a particular combination, but it seems to happen with any combination. Some of the values I've tried are; REQUESTED OBTAINED freq: 22050 22050 format: AUDIO_S16SYS AUDIO_S16SYS channels: 2 2 samples: 256 128 freq: 44100 44100 format: AUDIO_S16SYS AUDIO_S16SYS channels: 2 2 samples: 256 128 freq: 44100 44100 format: AUDIO_F32 AUDIO_F32 channels: 2 2 samples: 256 128 freq: 44100 44100 format: AUDIO_F32 AUDIO_F32 channels: 1 1 samples: 256 128 freq: 48000 48000 format: AUDIO_S32SYS AUDIO_S32SYS channels: 4 4 samples: 512 256 This looks familiar to bug id 3073 but was closed as "Resolved Invalid".