On date Tuesday 2014-11-04 17:39:22 +0000, JULIAN GARDNER encoded:
> I have been working on a program which needs to do audio resampling, and used 
> muxing.c as a base but now i am coming up against a problem.
> 

> Changing muxing.c so that the sound produced by the routine
> get_audio_frame is not the same audio rate as the output causes an
> assert in the write_audio_frame routine, normally the program
> prodces the same audio rate that the output format is going to use,
> so the resampler really does nothing.

No the resampler is used to change sample format, in case the output
format doesn't support the input format.

> 
> Modifying the audio tmp_frame definition and the associated tables for the 
> resampler was easy but i have 1 thing which im struggling to understand
> 
> line 310 muxing.c
> 
> if (frame) { 

>         /* convert samples from native format to destination codec format, 
> using the resampler */ 
>         /* compute destination number of samples */ 

>         dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, 
> c->sample_rate) + frame->nb_samples, 
>                                                                 
> c->sample_rate, c->sample_rate, AV_ROUND_UP); 
>         av_assert0(dst_nb_samples == frame->nb_samples); 

This is suspect (the reason of this change is lost in the merges, so I
can't help).

> 
> 
> line 335 muxing.c
>         frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, 
> c->sample_rate}, c->time_base);
> 
> 

> As the current code stands the input and output sample_rate is the
> same, so this code really does nothing, but now i have it so that
> the output is 44100 and the input is 48000, this code needs
> changing, my initial thought was this will use the output sample
> rate, but i still get the assert
> 

> Can someone who knows more about this fix the demo so that the input
> sample rate != output sample rate

How are you using the code? How can you force the code to change
output sample rate? If you have a patch please share.
-- 
FFmpeg = Fascinating and Faithful Mind-dumbing Powerful Elegant Geek
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to