[mythtv-users] [ALSA] "Skipping" arround a show causes an Abort (or segfault).

John Patrick Poet john at BlueSkyTours.com
Sat Aug 21 19:17:49 EDT 2004


When using "pure" ALSA via my S/PDIF connection for audio, I get
segfaults/aborts in the ALSA code if I "JUMP/SKIP" arround in the video
very much.  I am using ALSA 1.0.5 since ALSA 1.0.6 has audio glitches.

If I use OSS emulation, the Aborts/Segfaults do not happen, but I get
several seconds of stuttering after a JUMP/SKIP which I do not get with
"pure" ALSA.

The crashes do not happen on every SKIP forward/backward, but they do
happen often.  With one particular show, I can consitantly cause a crash
by doing a dozen 30 second forward skips quickly, and then a couple of 6
second skips backwards.

I have attached a BackTrace in the hopes that someone can figure out
what is going wrong.


When I use GDB to catch one of these segfault/aborts, I can "up" a few
times which gets me this:

Program received signal SIGABRT, Aborted.
[Switching to Thread 1186577328 (LWP 14055)]
0xffffe410 in ?? ()
(gdb) up
#1  0x46b9a5bc in ?? ()
(gdb)
#2  0x00000006 in ?? ()
(gdb)
#3  0x000036e7 in ?? ()
(gdb)
#4  0x47fcae49 in raise () from /lib/tls/libc.so.6
(gdb)
#5  0x47fcc872 in abort () from /lib/tls/libc.so.6
(gdb)
#6  0x47fc4718 in __assert_fail () from /lib/tls/libc.so.6
(gdb)
#7  0x47853362 in snd_pcm_mmap_commit (pcm=0x43b67288, offset=4096,
     frames=1024) at pcm.c:5959

The file is alsa-lib-1.0.5/src/pcm/pcm.c, with gdb showing the "return"
} of the function:

snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
                       snd_pcm_uframes_t offset,
                       snd_pcm_uframes_t frames)
{
     assert(pcm);
     assert(offset == *pcm->appl.ptr % pcm->buffer_size);
     assert(frames <= snd_pcm_mmap_avail(pcm));
     return pcm->fast_ops->mmap_commit(pcm->fast_op_arg, offset, frames);
}

(gdb) print pcm
$18 = (snd_pcm_t *) 0x43b67288
(gdb) print pcm->fast_op_arg
$19 = (snd_pcm_t *) 0x43b67288
(gdb) print offset
$20 = 4096
(gdb) print frames
$21 = 1024

[EDIT]

When I *first* wrote this, I failed to print out the vars from the
asserts, so these prints are actually from a *second* run/crash:

(gdb) print pcm
$4 = (snd_pcm_t *) 0x82f71b0
(gdb) print offset
$5 = 2048
(gdb) print *pcm->appl.ptr
$6 = 822272
(gdb) print pcm->buffer_size
$7 = 16384
(gdb) print frames
$8 = 1024
(gdb) print snd_pcm_mmap_avail(pcm)
No symbol "snd_pcm_mmap_avail" in current context.
(gdb) print pcm->fast_op_arg
$9 = (snd_pcm_t *) 0x82f71b0

It looks to me like  "assert(offset == *pcm->appl.ptr %
pcm->buffer_size);" is probably the cause for the abort. but I have no
idea how it gets in this state.

[/EDIT]

Continue up the stack:

(gdb) up
#8  0x47868a52 in snd_pcm_mmap_write_areas (pcm=0x43b67288,
areas=0x46b9a800,
     offset=0, size=1024) at pcm_mmap.c:120

File is alsa-lib-1.0.5/src/pcm/pcm_mmap.c, at a line which reads:

         result = snd_pcm_mmap_commit(pcm, pcm_offset, frames);

(gdb) print pcm
$22 = (snd_pcm_t *) 0x43b67288
(gdb) print pcm_offset
$23 = 4096
(gdb) print frames
$24 = 1024

Continue up the stack:

(gdb) up
#9  0x478537c5 in snd_pcm_write_areas (pcm=0x43b67288, areas=0x46b9a800,
     offset=0, size=1024, func=0x478689a8 <snd_pcm_mmap_write_areas>)
     at pcm.c:6132

Back to alsa-lib-1.0.5/src/pcm/pcm.c, at a line which reads:

         err = func(pcm, areas, offset, frames);

(gdb) print pcm
$25 = (snd_pcm_t *) 0x43b67288
(gdb) print areas
$26 = (const snd_pcm_channel_area_t *) 0x46b9a800
(gdb) print offset
$27 = 0
(gdb) print frames
$28 = 0

Continue up the stack:

(gdb) up
#10 0x47868bdc in snd_pcm_mmap_writei (pcm=0x43b67288, buffer=0x46b9a910,
     size=1024) at pcm_mmap.c:180

Back to alsa-lib-1.0.5/src/pcm/pcm_mmap.c, at a line which reads:

     return snd_pcm_write_areas(pcm, areas, 0, size,
                    snd_pcm_mmap_write_areas);

(gdb) print pcm
$29 = (snd_pcm_t *) 0x43b67288
(gdb) print areas
$30 = 0x46b9a800
(gdb) print size
$31 = 1024
(gdb) print snd_pcm_mmap_write_areas
$32 = {snd_pcm_sframes_t (snd_pcm_t *, const snd_pcm_channel_area_t *,
     snd_pcm_uframes_t,
     snd_pcm_uframes_t)} 0x478689a8 <snd_pcm_mmap_write_areas>

Continue up the stack:

(gdb) up
#11 0x40918958 in AudioOutputALSA::WriteAudio (this=0x462fb008,
     aubuf=0x46b9a910 "", size=4096) at audiooutputalsa.cpp:263
Current language:  auto; currently c++

finally into some Myth code:  mythtv/libs/libmyth/audiooutputalsa.cpp,
at a line which reads:

         lw = snd_pcm_mmap_writei(pcm_handle, tmpbuf, frames);

(gdb) print pcm_handle
$33 = (snd_pcm_t *) 0x43b67288
(gdb) print tmpbuf
$34 = (unsigned char *) 0x46b9a910 ""
(gdb) print frames
$35 = 1024

Continue up the stack:

(gdb) up
#12 0x4091a385 in AudioOutputALSA::OutputAudioLoop (this=0x462fb008)
     at audiooutputalsa.cpp:596

File is still mythtv/libs/libmyth/audiooutputalsa.cpp, at a line which
reads:

                 WriteAudio(zeros, fragment_size);

(gdb) print zeros
$36 = "\000"
(gdb) print fragment_size
$37 = 4096

Continue up the stack:

(gdb) up
#13 0x4091b077 in AudioOutputALSA::kickoffOutputAudioLoop
(player=0x462fb008)
     at audiooutputalsa.cpp:678

File is still mythtv/libs/libmyth/audiooutputalsa.cpp, at a line which
reads:

     ((AudioOutputALSA *)player)->OutputAudioLoop();

(gdb) print player
$38 = (void *) 0x462fb008

Continue up the stack:

(gdb) up
#14 0x481fa98c in start_thread () from /lib/tls/libpthread.so.0
(gdb) up
#15 0x4805f16a in clone () from /lib/tls/libc.so.6
(gdb) up
Initial frame selected; you cannot go up.

Thanks in advance to anyone that helps solve this problem

John


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ALSA.bt.bz2
Type: application/x-bzip2
Size: 6987 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20040821/0a615874/ALSA.bt.bin


More information about the mythtv-users mailing list