On 05/10/2014 12:16 PM, Luca Barbato wrote:
> +int avresample_convert_frame(AVAudioResampleContext *avr,
> + AVFrame *out, AVFrame *in)
> +{
> + int ret, setup = 0;
> +
> + if (!avresample_is_open(avr)) {
> + if ((ret = avresample_config(avr, out, in, NULL)) < 0)
> + return ret;
> + setup = 1;
> + } else {
> + // return as is or reconfigure for input changes?
> + if ((ret = avresample_config_changed(avr, out, in)))
> + return ret;
What do you think about having an option to automatically reconfigure
without returning? It would simplify the user code if they know they
will always want default settings for any potential new configuration.
> + }
> +
> + if (out && !out->linesize[0]) {
> + out->nb_samples = avresample_max_output_samples(avr, in->nb_samples);
> + if ((ret = av_frame_get_buffer(out, 0)) < 0) {
> + if (setup)
> + avresample_close(avr);
> + return ret;
> + }
> + } else {
> + out->nb_samples = available_samples(out);
This would segfault if out is NULL.
Also, we should only override out->nb_samples if it is not already set
by the user.
> + }
> +
> + return convert_frame(avr, out, in);
> +}
Thanks,
Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel