[mythtv] Patch: Fix clicks and pops in OSS output
Ed Wildgoose
lists at wildgooses.com
Wed Aug 11 19:24:37 EDT 2004
This small patch fixes clicks and pops on the OSS output with my card
(RME 9632). Features of this card which cause problems are that it only
has two audio buffers, and the driver doesn't (normally) track the exact
free space on the card, only whether zero, one or two buffers are
empty. If you look closely at the various IF statements this can lead
to an underflow because we are actually waiting for the buffer to
completely empty each time
A similar bit of code is needed to the ALSA output library, but this
patch will likely apply completely ok anyway... In any case I will
prepare a full patch to alsa as well (and there are some other cleanups
to add to the alsa one as well) - however, I need to test the alsa patch
first before submitting and its rather late here now.
Please apply to cvs.
Ta
Ed W
P.S. unrelated, but I just recently "found" the switch to enable using
frame sync using the nvidia library rather than the RTC method. Output
is now much smoother (no doubt due to the idiosyncracies of this RME
card and it's dubious free space calcs...). Thanks for this!
-------------- next part --------------
Index: libs/libmyth/audiooutputoss.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/audiooutputoss.cpp,v
retrieving revision 1.15
diff -u -r1.15 audiooutputoss.cpp
--- libs/libmyth/audiooutputoss.cpp 29 Mar 2004 22:41:38 -0000 1.15
+++ libs/libmyth/audiooutputoss.cpp 11 Aug 2004 23:20:07 -0000
@@ -547,7 +547,7 @@
// should this use ioctl(audio_fd, SNDCTL_DSP_POST, 0) instead ?
space_on_soundcard = getSpaceOnSoundcard();
- if (fragment_size < space_on_soundcard)
+ if (fragment_size <= space_on_soundcard)
{
WriteAudio(zeros, fragment_size);
}
@@ -567,7 +567,7 @@
/* do audio output */
// wait for the buffer to fill with enough to play
- if (fragment_size >= audiolen(true))
+ if (fragment_size > audiolen(true))
{
VERBOSE(VB_AUDIO, QString("audio thread waiting for buffer to fill"
" fragment_size=%1, audiolen=%2")
@@ -601,7 +601,7 @@
// re-check audiolen() in case things changed.
// for example, ClearAfterSeek() might have run
- if (fragment_size < audiolen(false))
+ if (fragment_size <= audiolen(false))
{
int bdiff = AUDBUFSIZE - raud;
if (fragment_size > bdiff)
More information about the mythtv-dev
mailing list