vpxenc: discard frames that have been dropped by libvpx
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>
Thu, 27 Jul 2017 14:21:48 +0000 (17:21 +0300)
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>
Fri, 11 Aug 2017 11:32:37 +0000 (14:32 +0300)
commit36fc2a747ade50db69221a502d498efa890bf054
treee0f5e93bd00ba37c0dc5a25313a06b484e07e0cc
parent5e48e85fb7db4c31b5652c9a002574f2879da191
vpxenc: discard frames that have been dropped by libvpx

This fixes a memory leak. When dropframe-threshold has been set,
libvpx may output less frames than the input ones, which causes
some GstVideoCodecFrames to queue up in GstVideoEncoder's internal
frame queue with no chance of ever being all released. And because
the frames keep references to the input buffers, the input buffer
pool keeps allocating new buffers and memory usage grows very fast.
For example the following pipeline's memory usage grows at a rate
of about 1GB per minute!

videotestsrc ! capsfilter caps=video/x-raw,width=1920,height=1080,framerate=30/1,format=I420 ! \
  vp8enc target-bitrate=1000000 end-usage=cbr dropframe-threshold=95 ! fakesink

https://bugzilla.gnome.org/show_bug.cgi?id=783086
ext/vpx/gstvpxenc.c