[FFmpeg-devel] libswresample swr_compensate and swr_init

Marton Balint cus at passwd.hu
Sat Jan 7 12:28:11 CET 2012


Currently swr_init() does not create the resampler, if the input and 
output frequency matches. But swr_compensate() expects the resampler to 
exist, and it crashes if it does not.

So what should be done here?

a) if the user plans to use swr_compensate then he should pass the 
SWR_FLAG_RESAMPLE flag to swr_init, and we should mention this requirement 
in the documentation. Also fix swr_compensate not to crash but log an 
error message if the resampler does not exist. (Unfortunately the return 
type of that function is void...)

b) fix swr_compensate to create the resampler by itself if necessary. 
Again the return type of swr_compensate is void, so extending the API may 
be required for this.

c) some other way :)

I'd vote for plan b)


More information about the ffmpeg-devel mailing list