]> git.sesse.net Git - ffmpeg/commit
avfilter/af_headphone: Only attempt once to init coeffs
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 25 Aug 2020 13:00:52 +0000 (15:00 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 9 Sep 2020 11:46:24 +0000 (13:46 +0200)
commit5e68727fa7265a1f2eb0faf63e0b87869cc41199
treef0b9dcc217cab5d6c68e7c56734d30d35f7184db
parenta84c77396bf17dc12925f1c5e25851df55660162
avfilter/af_headphone: Only attempt once to init coeffs

The headphone filter does most of its initialization after its init
function, because it can perform certain tasks only after all but its
first input streams have reached eof. When this happens, it allocates
certain buffers and errors out if an allocation fails.

Yet the filter didn't check whether some of these buffers already exist
(which may happen if an earlier attempt has been interrupted in the
middle (due to an allocation error)) in which case the old buffers leak.

This commit makes sure that initializing the buffers is only attempted
once; if not successfull at the first attempt, future calls to the
filter will error out. Trying to support resuming initialization doesn't
seem worthwhile.

Notice that some allocations were freed before a new allocation was
performed; yet this effort was incomplete. Said code has been removed.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavfilter/af_headphone.c