summaryrefslogtreecommitdiffstats
path: root/filters/f_swresample.c
Commit message (Collapse)AuthorAgeFilesLines
* swresample: minor simplificationwm42018-02-031-7/+6
| | | | Cosmetic and no change in behavior. At least I think this looks simpler.
* swresample: remove unnecessary request for new inputwm42018-02-031-1/+2
| | | | | | | | | | | We called mp_pin_out_request_data() if there was input _and_ output. This is not how it should be: we should request new input only if output was requested, but we could not produce any output. On the other hand, the upper half of the process() function will request new input if output is required, but all input was consumed. But this requires calling mp_filter_internal_mark_progress(), as otherwise the general filter logic would not know that we can continue.
* swresample: actually reinit resampler on large speed changeswm42018-02-031-5/+13
| | | | | | | | | | | | | | | | | | | If the speed is changed by a large amount, we need to effectively change the output rate by a large amount, and swr_set_compensation() is apparently not designed to handle such large changes well. So it's better to reinitialize the resampler on all large changes. Also, strictly reinitialize the resampler if the rate changes, otherwise it could happen that libavresample (which does not automatically initialize resampling if avresample_set_compensation() is used) would never apply speed changes properly. Also document some conditions better that handle corner cases (remove the inline condition from the if gating the compensation code). It also appears that we crashed with very large compensation ratios (when raising audio speed quickly by keeping the "[" key down), and this commit accidentally mitigates it by not allowing large compensation.
* swresample: limit output size of audio frameswm42018-02-031-35/+56
| | | | | | | | | | | | | | Similar to the previous commit, and for the same reasons. Unlike with af_scaletempo, resampling does not have a natural frame size, so we set an arbitrary size limit on output frames. We add a new option to control this size, although I'm not sure whether anyone will use it, so mark it for testing only. Note that we go through some effort to avoid buffering data in libswresample itself. One reason is that we might have to reinitialize the resampler completely when changing speed, which drops the buffered data. Another is that I'm not sure whether the resampler will do the right thing when applying dynamic speed changes.
* audio: rewrite filtering glue codewm42018-01-301-0/+717
Use the new filtering code for audio too.