mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Handle when ALSA tweaks our sample spec so much that the frame size changes.
(closes #57). git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1431 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
6ba21d4a0b
commit
bb812433a8
3 changed files with 13 additions and 3 deletions
|
|
@ -159,7 +159,11 @@ static void do_write(struct userdata *u) {
|
|||
memchunk = &u->memchunk;
|
||||
}
|
||||
|
||||
assert(memchunk->memblock && memchunk->memblock->data && memchunk->length && memchunk->memblock->length && (memchunk->length % u->frame_size) == 0);
|
||||
assert(memchunk->memblock);
|
||||
assert(memchunk->memblock->data);
|
||||
assert(memchunk->length);
|
||||
assert(memchunk->memblock->length);
|
||||
assert((memchunk->length % u->frame_size) == 0);
|
||||
|
||||
if ((frames = snd_pcm_writei(u->pcm_handle, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length / u->frame_size)) < 0) {
|
||||
if (frames == -EAGAIN)
|
||||
|
|
@ -415,6 +419,9 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
/* ALSA might tweak the sample spec, so recalculate the frame size */
|
||||
frame_size = pa_frame_size(&ss);
|
||||
|
||||
if (ss.channels != map.channels)
|
||||
/* Seems ALSA didn't like the channel number, so let's fix the channel map */
|
||||
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue