Commit Graph

9 Commits

Author SHA1 Message Date
Martin Herkt a17ea73636 af_rubberband: actually fix deadlock
371e5d0 missed this one
2015-02-12 10:15:12 +01:00
wm4 371e5d0665 af_rubberband: fix filter error deadlock
rubberband_available() can return a negative value, which we assigned to
a size_t variable, leading to the frame allocation to fail. This could
spam "Error filtering frame.". (That it spams this instead of exiting
should probably also be considered a bug.)

At least in the realtime mode and in our case, a negative return value
should not have any different meaning from a 0 return value, in
particular because we call rubberband_get_samples_required() or set the
"final" parameter for rubberband_process() to continue/stop processing.
2015-02-12 09:47:01 +01:00
Martin Herkt 2dc49ea866 af_rubberband: change defaults
After some testing, I am fairly convinced that these defaults sound
better than the previous settings. This also eliminates some issue
with random crackling and noise.

Also remove the `stretch` option since it has no effect in
realtime mode.
2015-02-12 00:58:40 +01:00
wm4 6299da2047 af_rubberband: fix breakage
The previous commit on this filter accidentally removed the
RubberBandOptionProcessRealTime option. Without it, the lib prints a
warning and passes the audio through.

Also add the RubberBandOptionSmoothingOn option back. Though for some
reason the output sounds still very wrong.
2015-02-11 21:32:01 +01:00
wm4 df5548a754 af_rubberband: make all librubberband options configurable
librubberband exports a big load of options. Normally, the default
settings (whether they're librubberband defaults or our defaults) should
be sufficient, but since I'm not so sure about this, making it
configurable allows others to figure it out for me.
2015-02-11 17:11:05 +01:00
wm4 6f24a61d84 af_rubberband: attempt to fix audio position calculation
The problem here is that librubberband can buffer an arbitrary amount
of data, but at the same time doesn't provide a way to query how much
data is buffered. So we keep track of this manually, assuming that
librubberband tries to reach the requested time ratio for input and
output (which is probably true).

The disadvantage is that rounding errors could accumulate over time.
(Maybe it should try to round towards keeping the time ratio.)
2015-02-11 16:32:40 +01:00
wm4 76501f4f57 af_rubberband: always calculate and set delay
Basically, add an if and reindent the block instead of exiting early.
2015-02-11 16:32:40 +01:00
wm4 8c055f873f af_rubberband: improve EOF handling
In theory it could happen that draining on EOF happens incrementally,
and then the unconditional reset could have dropped the remaining
buffered audio.
2015-02-11 16:31:35 +01:00
wm4 b6ab34fc98 af_rubberband: pitch correction with librubberband
If "--af=rubberband" is used, librubberband will be used to speed up or
slow down audio with pitch correction.

This still has some problems: the audio delay is not calculated
correctly, so the audio position jitters around by a few milliseconds.
This will probably ruin video timing.
2015-02-11 00:29:12 +01:00