[MPlayer-dev-eng] [PATCH] Online audio stream switching

D Richard Felker III dalias at aerifal.cx
Mon Feb 28 20:12:56 CET 2005


On Mon, Feb 28, 2005 at 12:31:13PM -0600, Joey Parrish wrote:
> On Mon, Feb 28, 2005 at 10:37:53AM -0500, D Richard Felker III wrote:
> > > > A single keypress will make it horribly crash unless the new audio
> > > > track has exactly the same codec and format as the old one. This is
> > > > very bad. Consider DVDs that have some tracks as 2.0 AC3 and others as
> > > > 5.1 AC3, or a mix of AC3, PCM, and DTS. Unless you work out all the
> > > > mess to close down and reinitialize the audio layer for the newly
> > > > selected audio track, a patch like this (which only works on a very
> > > > limited number of files and crashes on all the rest) is not
> > > > acceptable. I know it's very hard to do this right (that's why no one
> > > > has done it yet..) but that's the way it is. Sorry..
> 
> > > Well, the patch already knows about the difference between AC3, PCM and DTS
> > > and switches only between streams of the same format. Switching
> > > between 2.0 AC3 and 5.1 AC3 did not make problems here but please
> > > send me a sample where it does.
> 
> > do you have a 5.1 setup? if not, it will just decode both as 2.0 so no
> > problem should arise...but i wonder what happens if you have 5.1
> > output available..
> 
> Well, if it checks the format to ensure no crashing, I say it's a very
> good thing to have.  What's the down side when compared to no switching
> at all?

If it's safe, I agree, it's ok to add. But I'm still worried about
cases that might seem safe but not be, e.g. switching between
apparently-compatible vorbis streams when they actually have different
dictionaries or whatever crap goes in the global header.

Of course for this patch vorbis is irrelevant since it's MPEG-only, so
we're probably safe. But if we want to do this kind of switching in
more generality, it needs to do full reinit of the audio system, IMO.

Rich





More information about the MPlayer-dev-eng mailing list