[FFmpeg-devel] [PATCH]. Replace codec when stream changes from PCM_DVD to PCM_S16BE

Michael Niedermayer michaelni
Thu Mar 25 20:22:36 CET 2010


On Fri, Mar 26, 2010 at 12:51:25AM +0800, avcoder wrote:
> On Thu, Mar 25, 2010 at 12:04 AM, stanley kamithi <skamithi at gmail.com> wrote:
> > Hello
> >
> > Found this problem while using the latest mythtv.
> > I have a few dvds where ffmpeg says the first few audio packets are detected
> > to use the PCM_DVD codec and subsequent packets use PCM_S16BE.
> > In libavformat/mpeg.c, when this change is detected, it only changes the
> > codec type in the AvCodecContext and nothing else. The problem is that
> > mythtv fails to decode subsequent audio frames properly
> > because the codec hasn't changed. It still using the PCM_DVD codec so you
> > get issues like wrong sample depth causing no audio output or wrong sample
> > format causing playback to be too fast.
> > Attach patch, against the latest ffmpeg, ?corrects the problem by closing
> > the existing codec and attaching the correct one.
> >
> > Please review and provide your comments.
> >
> 
> Your patch is wrong!
> 
> In a normal scenario of decoding, A/V packet is cached firstly in
> demux thread, and then decoded in audio/video decoding thread
> you can not dynamically switch to a new codec by avcodec_close(), the
> audio/video decoding thread will crash if they still use the older
> codec to decode the old cached A/V packet.

yes


> 
> We need a general implementation to support codec dynamically switch,

if codec switches, create a new AVStream


[....]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100325/d4ea58c1/attachment.pgp>



More information about the ffmpeg-devel mailing list