snd_hda, mplayer, and S/PDIF pass-through

Alexander Motin mav at FreeBSD.org
Mon Jan 12 23:25:11 PST 2009


Christian Weisgerber wrote:
> FreeBSD 8.0-CURRENT box with snd_hda audio.
> 
> Since I recently got an AV receiver that supports AC3 and DTS
> decoding, I had to try S/PDIF pass-through.  I followed the suggestions
> mav@ had previously provided here:
> * disable vchans (sysctl dev.pcm.2.play.vchans=0)
> * mixer vol 100 pcm 100
> 
> With this, "mplayer -ac hwac3" (or -ac hwdts) starts playing AC3
> (DTS) audio tracks from DVD just fine, i.e., they are passed through
> the S/PDIF interface to the receiver which decodes them and confirms
> this with various status messages.
> 
> However, once the audio stream is interrupted, e.g. by pausing
> playback, it cannot be restarted.  mplayer resumes... and the
> receiver misdetects the audio as PCM 48 and produces the corresponding
> noise.
> 
> Any ideas what's going there?

It looks like mplayer bug, it does not sets sample rate on resume.
Attached patch fixes it for me.

-- 
Alexander Motin
-------------- next part --------------
--- ao_oss.c.prev	2007-10-07 22:49:27.000000000 +0300
+++ ao_oss.c	2008-11-29 21:51:21.000000000 +0200
@@ -433,6 +433,7 @@ static void reset(void){
   fcntl(audio_fd, F_SETFD, FD_CLOEXEC);
 #endif
 
+  ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
   oss_format = format2oss(ao_data.format);
   ioctl (audio_fd, SNDCTL_DSP_SETFMT, &oss_format);
   if(ao_data.format != AF_FORMAT_AC3) {
@@ -442,7 +443,6 @@ static void reset(void){
       int c = ao_data.channels-1;
       ioctl (audio_fd, SNDCTL_DSP_STEREO, &c);
     }
-    ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
   }
 }
 


More information about the freebsd-multimedia mailing list