[mythtv] Fwd: iec958 output (not passthrough) with Alsa rate plugin problem
Lawrence Freil
lef at freil.com
Mon Jan 15 15:29:14 UTC 2007
Hello,
I have discovered a little problem with MythTV and audio output. For ac3
output I'm using the passthrough feature to the iec958 device to a surround
sound reciever. This works fine, however when the audio is not ac3 I also
want the output to go to iec958. I have created a rate plugin pcm (hq48k)
for alsa to change the rate from 44.1 to the 48Kz required by the digital
output device and then set the non-passthrough device to ALSA:hq48k. Using
this setup with the MythMusic plugin causes skipping audio. The cause of
the issue is related to how buffering works and the results returned by
snd_pcm_delay and snd_pcm_avail_update. The added buffering appears to
cause Myth to think there are underruns and it skips to catch up.
I have created a temporary workaround with the following patch, however
it is most certianly not the best way to handle it. Perhaps changing the
high-water/low-water marks to a percentage of available space would be
more appropriate instead of bytes.
*** audiooutputalsa.cpp 2007-01-12 19:59:47.838308667 -0500
--- Naudiooutputalsa.cpp 2007-01-12 20:02:45.280420517 -0500
***************
*** 283,288 ****
--- 283,291 ----
(snd_pcm_uframes_t)avail >
(snd_pcm_uframes_t)soundcard_buffer_size)
avail = soundcard_buffer_size;
+ if (avail > 1132)
+ avail = avail - 1132;
+
int space = (avail * audio_bytes_per_sample) - audio_buffer_unused;
Suggested real fixes would be appriciated.
--
Lawrence Freil
lef at freil.com
More information about the mythtv-dev
mailing list