mirror of https://github.com/mpv-player/mpv
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:
parent
a8be8fe4f4
commit
3cea180cc0
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue