Skip to content

vpx_alpha: fix leaks and refactor merging

p_sys is used by the pool to forward the picture pool context. Pictures that are supporting copying should be using picture context instead, which the vpx_alpha decoder was already doing.

This fixes a huge memory leak of picture data when playing VP9 videos.

STACK OF 1242 INSTANCES OF 'ROOT LEAK: malloc[2097152]':
9   libsystem_pthread.dylib               0x185e89d34 thread_start + 8
8   libsystem_pthread.dylib               0x185e8ef94 _pthread_start + 136
7   libvlccore.9.dylib                    0x1032606cc DecoderThread + 348  decoder.c:1869
6   libvlccore.9.dylib                    0x103262c04 DecoderThread_DecodeBlock + 256  decoder.c:1627
5   ???                                   0x107066034 0x7fffffffffffffff + 9223372041267601461
4   ???                                   0x12a809674 0x7fffffffffffffff + 9223372041862813301
3   ???                                   0x107065c70 0x7fffffffffffffff + 9223372041267600497
2   ???                                   0x107066644 0x7fffffffffffffff + 9223372041267603013
1   ???                                   0x1070662ec 0x7fffffffffffffff + 9223372041267602157
0   libsystem_malloc.dylib                0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148

Instruments correctly indicates the following trace:

CombinePicturesCPU
SendMergedLocked
QueuePic
ecoder_QueueVideo
ecodeBlock
DecodeVideo
Decode
DecoderThread_DecodeBlock
DecoderThread
_pthread_start
thread_start

The MR then establish reference counting for the picture context as well as some minor early return which removes some branching complexity and separate the allocation path against the re-use path.

Fixes #28792 (closed)

Merge request reports

Loading