From: Takashi Iwai Subject: Re: Re: [ALSA - driver 0001938]: EPIPE on Audigy with surround sound when seeking in 6 channel sound file Date: Fri, 31 Mar 2006 12:15:26 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Robert Hardy Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Thu, 30 Mar 2006 18:53:23 -0500 (EST), Robert Hardy wrote: > > On Thu, 30 Mar 2006, Takashi Iwai wrote: > > At Thu, 30 Mar 2006 12:09:06 -0500 (EST), Robert Hardy wrote: > >> cd /el4_i386_chroot > >> setarch i386 chroot . > >> > >> # mplayer -vo xv -ao alsa -channels 6 An_AC3_movie.avi |& less > >> > >> MPlayer dev-Fedora-GS-CVS-060328-14:45-3.4.5 (C) 2000-2006 MPlayer Team > >> [...] > >> [ attempt to seek with right arrow ] > >> alsa-lib: pcm.c:6300:(snd_pcm_mmap_commit) commit offset (0) doesn't match with appl_ptr (291840) % buf_size (16384) > >> alsa-play: write error: Broken pipe > >> alsa-play: trying to reset soundcard > >> alsa-lib: pcm.c:6300:(snd_pcm_mmap_commit) commit offset (0) doesn't match with appl_ptr (291840) % buf_size (16384) > > > > That looks bad. Could you set $LIBASOUND_DEBUG=2 and run it from gdb? > > It will send abort() at that place, then you can see backtrace what is > > the original caller. > > > > does it happen if you play via aplay like > > % aplay -Dplug:surround51 some.wav > > too? > > No it only happens when I seek 6 channel audio. I can play something with > mplayer -ao alsa -channels 6 and it will play fine _UNTIL_ I seek. Then it > blows up. > > So something like this will immediately fail: > mplayer -ao alsa -channels 6 -ss 00:01:00 An_AC3_movie.avi > > With this stuff: > alsa-lib: pcm.c:6300:(snd_pcm_mmap_commit) commit offset (0) doesn't match with appl_ptr (291840) % buf_size (16384) > alsa-play: write error: Broken pipe > alsa-play: trying to reset soundcard > > If I switch to a 64 bit chrooted environment with a 64 bit mplayer the audio > works properly. But then I can't use any of the 32 bit codecs. > > >> Is there some way I can comment directly on bug 1938 in Mantis? > > > > I don't know. I heard it should be fixed now. > > The author of the bug seems to think it's still broken and seems to have > beat me to posting a backtrace. It's been a busy day here. If you still want > me to do this let me know. > > > Honestly, I hate bugtracking systems. Bug reports and communcations > > on ML motivates me much better :) > > k email it is 8o) I'd love to get this fixed... I think I got it. It looks like the old applptr that are not updated by the prepare call due to pcm links. Try the patch below. Takashi Index: alsa-lib/src/pcm/pcm_hw.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_hw.c,v retrieving revision 1.114 diff -u -r1.114 pcm_hw.c --- alsa-lib/src/pcm/pcm_hw.c 29 Mar 2006 09:30:49 -0000 1.114 +++ alsa-lib/src/pcm/pcm_hw.c 31 Mar 2006 10:04:17 -0000 @@ -624,6 +624,9 @@ SYSMSG("SNDRV_PCM_IOCTL_REWIND failed"); return err; } + err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL); + if (err < 0) + return err; return frames; } @@ -637,6 +640,9 @@ SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed"); return err; } + err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL); + if (err < 0) + return err; return frames; } else { snd_pcm_sframes_t avail; Index: alsa-lib/src/pcm/pcm_multi.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_multi.c,v retrieving revision 1.72 diff -u -r1.72 pcm_multi.c --- alsa-lib/src/pcm/pcm_multi.c 27 Feb 2006 12:39:29 -0000 1.72 +++ alsa-lib/src/pcm/pcm_multi.c 31 Mar 2006 10:04:17 -0000 @@ -424,8 +424,9 @@ int err = 0; unsigned int i; for (i = 0; i < multi->slaves_count; ++i) { - if (multi->slaves[i].linked) - continue; + /* We call prepare to each slave even if it's linked. + * This is to make sure to sync non-mmaped control/status. + */ err = snd_pcm_prepare(multi->slaves[i].pcm); if (err < 0) return err; @@ -439,8 +440,7 @@ int err = 0; unsigned int i; for (i = 0; i < multi->slaves_count; ++i) { - if (multi->slaves[i].linked) - continue; + /* Reset each slave, as well as in prepare */ err = snd_pcm_reset(multi->slaves[i].pcm); if (err < 0) return err; ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642