[FFmpeg-devel] MPEG TS encoding problem on change from stereo to mono, pay for fix

Reimar Döffinger Reimar.Doeffinger
Thu Dec 2 08:32:33 CET 2010


On Thu, Dec 02, 2010 at 01:38:33AM +0100, Michael Niedermayer wrote:
> On Wed, Dec 01, 2010 at 06:20:18PM +0100, Reimar D?ffinger wrote:
> > On Wed, Dec 01, 2010 at 05:00:19PM +0100, Michael Niedermayer wrote:
> > > On Wed, Dec 01, 2010 at 09:14:03AM +0100, Reimar D?ffinger wrote:
> > > > On Wed, Dec 01, 2010 at 04:10:49AM +0100, Michael Niedermayer wrote:
> > > > > On Wed, Nov 24, 2010 at 12:10:47AM +0100, Stefano Sabatini wrote:
> > > > > > @@ -776,7 +779,7 @@ static void do_audio_out(AVFormatContext *s,
> > > > > >      int64_t audio_out_size, audio_buf_size;
> > > > > >      int64_t allocated_for_size= size;
> > > > > >  
> > > > > > -    int size_out, frame_bytes, ret;
> > > > > > +    int size_out, frame_bytes, ret, resample_changed;
> > > > > >      AVCodecContext *enc= ost->st->codec;
> > > > > >      AVCodecContext *dec= ist->st->codec;
> > > > > >      int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8;
> > > > > > @@ -810,7 +813,28 @@ need_realloc:
> > > > > 
> > > > > 
> > > > > >      if (enc->channels != dec->channels)
> > > > >            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > > >          ost->audio_resample = 1;
> > > > > >  
> > > > > > -    if (ost->audio_resample && !ost->resample) {
> > > > > > +    resample_changed = ost->resample_sample_fmt  != dec->sample_fmt ||
> > > > > > +                       ost->resample_channels    != dec->channels   ||
> > > > > 
> > > > > this looks redundant
> > > > 
> > > > Huh? One checks whether decoder output and encoder input differ,
> > > > the other one checks whether the decoder output format changed...
> > > 
> > > they can differ and still not change?
> > 
> > I don't understand what is unclear here.
> 
> its not unclear, i just thought it would be simpler to drop the enc != dec
> check and use the expected resampler input != dec for it by initially setting
> it to the enc value
> but i did not investigate this further at all it was just a thought from taking
> a quick look

Ah, ok. I don't know, it is possible it might be more confusing since we
need to check whether we need a resampler at all anyway.
I don't know.



More information about the ffmpeg-devel mailing list