[mythtv-users] mythtv audio stuttering on 720p material after upgrade to Fedora 9

Don Lewis dl-mythtv at catspoiler.org
Thu Oct 2 01:54:56 UTC 2008


On 15 Sep, Don Lewis wrote:
> Yesterday I upgraded my myth box from 0.21 and Fedora 7 to the latest
> 0.21+fixes and Fedora 9 using the rpms from atrpms.net.  My hardware is
> an Athlon 64 X2 4000+ on an Abit AN-M2HD motherboard with 1GB of RAM.
> I'm using the onboard GeForce 7050 graphics and driving my TV in 720P
> mode through HDMI output.  Sound output is via the motherboard S/PDIF
> output.  The video driver is the latest from Nvidia.  I'm using ffmpeg +
> XVideo.  I've got UseEvents set to "true" in xorg.conf.
> 
> Before the upgrade, the only playback problem that I had was occasional
> tearing that was mostly visible during horizontal pans, probably because
> I haven't been able to enable OpenGL vertical sync.
> 
> Almost everything works fine since the upgrade.  The exception is
> playback of previously recorded 720P material.  SD material works fine,
> as does 1080i material, as long as I don't use an overly expensive
> deinterlace mode.
> 
> When I try to play a recording that was broadcast in 720P, the audio
> stutters every few seconds and the video seems to alternate between
> running at full speed and at about half speed with the same rhythm as
> the audio problems.  When the audio drops out, my receiver shows that
> the digital audio signal has has been lost.  The problem is much worse
> if I disable the extra audio buffering.  Then I only get brief snippets
> of sound, and the video appears to be running slow all the time. I've
> tried twiddling a bunch of the playback knobs and nothing seems to help.
> CPU usage is low, maybe 30%,, and the problem still occurs even if I set
> deinterlacing to none.  I can play the same recording using mplayer and
> it works just fine.  The log file shuws a bunch of buffer underruns:

I was able to fix the 720P playback problem on my machine with the patch
below, which increases the number of video buffers to accomodate more
uneveness of video vs. audio packets in the data stream and allow more
video to be processed before the player runs out of audio data.  I
believe that this is a problem for 720P and not 480i and 1080i because
720P is ~60 fps whereas the others are only ~30 fps, so 720P might need
to buffer two times as many video frames to cover the same time gap in
audio packets.

Just increasing the video buffering broke 480i and 1080i playback by
causing a bunch of "Audio buffer overflow, audio data lost!" errors, so
I had to increase the amount of audio buffering as well.

I have no idea why only Fedora 9 appears to be affected.

See <http://svn.mythtv.org/trac/ticket/5749> for more details.

--- mythtv-0.21/libs/libmythtv/videoout_xv.cpp.orig	2008-10-01 11:17:19.000000000 -0700
+++ mythtv-0.21/libs/libmythtv/videoout_xv.cpp	2008-10-01 11:18:33.000000000 -0700
@@ -885,7 +885,7 @@
 
     // Create ffmpeg VideoFrames
     if (!done)
-        vbuffers.Init(31, true, 1, 12, 4, 2, false);
+        vbuffers.Init(62, true, 1, 12, 4, 2, false);
 
     if (!done && use_opengl)
         done = InitOpenGL();
--- mythtv-0.21/libs/libmyth/audiooutputbase.h.orig	2008-02-10 12:56:11.000000000 -0800
+++ mythtv-0.21/libs/libmyth/audiooutputbase.h	2008-10-01 13:13:11.000000000 -0700
@@ -31,7 +31,7 @@
 //#define AUDBUFSIZE 768000
 //divisible by 12,10,8,6,4,2 and around 1024000
 //#define AUDBUFSIZE 1024080
-#define AUDBUFSIZE 1536000
+#define AUDBUFSIZE (2*1536000)
 
 class AudioOutputBase : public AudioOutput
 {
--- mythtv-0.21/libs/libmyth/audiooutputbase.cpp.orig	2008-02-25 16:08:51.000000000 -0800
+++ mythtv-0.21/libs/libmyth/audiooutputbase.cpp	2008-10-01 13:32:41.000000000 -0700
@@ -699,7 +699,7 @@
         len += (pSoundStretch->numUnprocessedSamples() +
                 (int)(pSoundStretch->numSamples()/audio_stretchfactor))*abps;
 
-    if (((len > afree) || ((audbuf_timecode - GetAudiotime()) > 2000)) && !blocking) 
+    if (((len > afree) || ((audbuf_timecode - GetAudiotime()) > 4000)) && !blocking) 
     {
         VERBOSE(VB_AUDIO|VB_TIMESTAMP, LOC + QString(
                 "AddSamples FAILED bytes=%1, used=%2, free=%3, timecode=%4") 
@@ -768,7 +768,7 @@
                 (int)(pSoundStretch->numSamples()/audio_stretchfactor))*abps;
     }
 
-    if (((len > afree) || (audiotime && ((audbuf_timecode - GetAudiotime()) > 2000))) && !blocking) 
+    if (((len > afree) || (audiotime && ((audbuf_timecode - GetAudiotime()) > 4000))) && !blocking) 
     {
         VERBOSE(VB_AUDIO|VB_TIMESTAMP, LOC + QString(
                 "AddSamples FAILED bytes=%1, used=%2, free=%3, timecode=%4") 



More information about the mythtv-users mailing list