Folks,

Attached is a patch that works around the problem caused by the via unichrome 
XvMC and AC3 patches not liking each other. I have posted this fix before but 
it won't patch cleanonto cvs now, this will. 

I have also fixed a problem with the log message being inccorect in 
autoSelectAudioTack as well.

I have been running this on my EPIA with vldXvMC for the last couple of days 
with no audio or video problems. Could someone who was experiencing this 
problem please take the time to check that this patch does not re-introduce 
your problem. 

Without this patch, audio on DVB will not work correctly. You will loose audio 
on channel change.

Cheers,
Mark Anderson
Index: libs/libmythtv/avformatdecoder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/avformatdecoder.cpp,v
retrieving revision 1.135
diff -b -u -p -r1.135 avformatdecoder.cpp
--- libs/libmythtv/avformatdecoder.cpp	6 Feb 2005 04:29:27 -0000	1.135
+++ libs/libmythtv/avformatdecoder.cpp	8 Feb 2005 21:38:01 -0000
@@ -256,18 +256,16 @@ void AvFormatDecoder::Reset(void)
     SeekReset();
 
     //
-    // This breaks channel changes on normal XvMC (and possibly XvMC VLD)
-    //
-#if 0
-    // Clear out the existing mpeg streams
+    // Clear out the existing audio streams
     // so we can get a clean set from the 
     // new seek position.
     for (int i = ic->nb_streams - 1; i >= 0; i--)
     {
+        if (ic->streams[i]->codec.codec_type == CODEC_TYPE_AUDIO)
+        {
         av_remove_stream(ic, ic->streams[i]->id);
     }
-#endif
-
+    }
     m_positionMap.clear();
     framesPlayed = 0;
     framesRead = 0;
@@ -1215,7 +1213,6 @@ bool AvFormatDecoder::autoSelectAudioTra
     if (!audioStreams.size())
         return false;
 
-    bool foundAudio = false;
     int minChannels = 1;
     int maxTracks = (audioStreams.size() - 1);
     int track;
@@ -1225,7 +1222,7 @@ bool AvFormatDecoder::autoSelectAudioTra
     int selectedTrack = -1;
     int selectedChannels = -1;
     
-    while ((!foundAudio) && (minChannels >= 0))
+    while ((selectedTrack == -1) && (minChannels >= 0))
     {
         for (track = maxTracks; track >= 0; track--)
         {
@@ -1239,7 +1236,6 @@ bool AvFormatDecoder::autoSelectAudioTra
                 if (e->codec_id == CODEC_ID_AC3)
                 {
                     selectedTrack = track;
-                    foundAudio = true;
                     break;
                 }
 
@@ -1248,11 +1244,12 @@ bool AvFormatDecoder::autoSelectAudioTra
                     //this is a candidate with more channels
                     //than the previous, or there was no previous
                     //so select it.
+                    selectedChannels = e->channels;
                     selectedTrack = track;
                 }
             }
         }
-        if (!foundAudio)
+        if (selectedTrack == -1)
         {
         minChannels--;
         }
@@ -1261,6 +1258,9 @@ bool AvFormatDecoder::autoSelectAudioTra
     if (selectedTrack == -1)
     {
         //no suitable track was found
+        VERBOSE(VB_AUDIO,
+                QString("No suitable audio track exists.")
+                .arg(wantedAudioStream));
     return false;
     }
 
@@ -1281,7 +1281,7 @@ bool AvFormatDecoder::autoSelectAudioTra
                 .arg(selectedTrack + 1).arg(wantedAudioStream));
         VERBOSE(VB_AUDIO, 
                 QString("It has %1 channels and we needed at least %2")
-                .arg(selectedChannels).arg(minChannels + 1));
+                .arg(selectedChannels).arg(do_ac3_passthru ? 2 : 1));
     }
     SetupAudioStream();
     CheckAudioParams(e->sample_rate, e->channels, true);
_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to