packet: free some unnecessary memory in disk cache case

If the disk cache is used, the AVPacket is not used anymore and is
completely deallocated when the packet is written to disk. As a minor
bug, the AVPacket allocation itself was not freed (although it wasn't a
memory leak, since talloc still automatically freed it when the entire
demux_packet was freed). For very large caches, this could easily add up
to over hundred MB, so actually free the unneeded allocation.
This commit is contained in:
wm4 2019-07-06 23:45:10 +02:00
parent a8be8fe4f4
commit 3cea180cc0
1 changed files with 2 additions and 1 deletions

View File

@ -38,8 +38,9 @@
void demux_packet_unref_contents(struct demux_packet *dp)
{
if (dp->avpacket) {
av_packet_unref(dp->avpacket);
assert(!dp->is_cached);
av_packet_unref(dp->avpacket);
talloc_free(dp->avpacket);
dp->avpacket = NULL;
dp->buffer = NULL;
dp->len = 0;