diff options
author | wm4 <wm4@nowhere> | 2012-08-26 21:40:54 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-08-26 22:17:27 +0200 |
commit | 413c6f5b306ec3b36b3003d1834328960504ec1c (patch) | |
tree | a8bc668033e65f6e0db2db2bb23039ca70ad6991 /mp_core.h | |
parent | 424822b5378317628de2babff1b5da27d235764b (diff) | |
download | mpv-413c6f5b306ec3b36b3003d1834328960504ec1c.tar.bz2 mpv-413c6f5b306ec3b36b3003d1834328960504ec1c.tar.xz |
af_scaletempo: fix crash on channel reconfiguration
This crash happened when audio channels were reconfigured from 6
channels to 2, and playback speed was set to 2.
The crash is caused by passing a negative size to memcpy. It appears
reinitialization doesn't clear the buffer. As the result, the buffer
can be larger as the maximum buffer size, i.e. the invariant
bytes_queued <= bytes_queue is violated.
Fix this by resetting the buffer length on reconfiguring (set the
bytes_queued vairable to 0). Also reset some other state for clarity
and robustness, although these changes aren't strictly needed for
avoiding the actual crash.
This may also get rid of some noise played right after reinitialization,
as the re-used buffer was in the wrong audio format.
Diffstat (limited to 'mp_core.h')
0 files changed, 0 insertions, 0 deletions