[mythtv] [PATCH] -- picking wrong AC-3 audio stream to play

Brad Templeton brad+mydev at templetons.com
Thu Feb 17 09:08:05 UTC 2005


[Whoops, somehow I sent this to users instead of dev]

This is a patch that seems to work for the problem I described in
a recent message to mythtv-users entitled:

    "Picking the wrong audio stream from multi-stream AC3 causing no sound?"


This patch makes the code do what the comments say it does, in that
the comments say it scans through the streams and picks the first adequate
audio stream.  The code has a countdown loop which breaks out at the first
match, which thus will be the highest numbered stream.

By changing it to a count-up loop, as shown below, it picks the earliest
AC3 stream.   However, I must say since people don't put in countdowns
instead of count-ups by accident, I may not be understanding the goal
here perfectly, and might suggest whoever made this code take another
look.

The patch works, in that it now picks the right stream, and I can hear
audio on the PBS programs which stopped working 10 days ago, either due
to a change at PBS or a change in Myth.   For some reason they have 3
streams, the 1st is the real one, the 3rd seems to be silence.




--- libs/libmythtv/avformatdecoder.cpp  15 Feb 2005 04:21:13 -0000      1.138
+++ libs/libmythtv/avformatdecoder.cpp  17 Feb 2005 07:23:12 -0000
@@ -1251,7 +1251,8 @@

     while ((selectedTrack == -1) && (minChannels >= 0))
     {
-        for (track = maxTracks; track >= 0; track--)
+        for (track = 0; track <= maxTracks; track++)
         {
             int tempStream = audioStreams[track];
             AVCodecContext *e = &ic->streams[tempStream]->codec;





More information about the mythtv-dev mailing list