Steve Lhomme
bdd95cd0d1
use es_format_HasVpxAlpha instead of local check
8 months ago
Steve Lhomme
fb1182e142
vpx: use i_level as a bitfield to mark/unmark alpha
We can keep the VP9 profile outside of the alpha pseudo decoder.
9 months ago
Steve Lhomme
6ccbc516c7
vpx: check explicitly for the alpha marker in the codec i_level
There may be other valid values than 0 or -1 for VP9.
9 months ago
Thomas Guillem
a4012afedd
vpx_alpha: drop alpha if opaque chroma is not supported
Continue with the hardware decoder without alpha support instead of
failing the vout (black screen).
9 months ago
Thomas Guillem
57a1173c3d
vpx_alpha: use decoder_LoadModule()
9 months ago
Alexandre Janniaux
b132d09580
vpx_alpha: reindent after last changes
2 years ago
Alexandre Janniaux
e3cad49115
vpx_alpha: early-return during merging
Early return to avoid mixing the allocation path and the re-use path,
making two level of indentation useless.
Indentation is changed in the follow-up commit.
2 years ago
Alexandre Janniaux
a3054e86ba
vpx_alpha: use picture context to forward plane
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
See ticket for details of the trace.
Fixes #28792
2 years ago
Alexandre Janniaux
85a28e9a1e
vpx_alpha: add reference-counting to picture context
The context is read-only and was currently copied for every picture, so
switch to reference counting to avoid this. It will also help when
moving planes stored in p_sys into the context, to determine when the
allocated plane should be released, and to copy/share the pointer
automatically.
2 years ago
Alexandre Janniaux
949a1d3276
codec: vpx_alpha: fix memory leak on format
The es_format_t instances are copying allocations like languages that
were not released for the internal decoders and the input format.
Leaks information:
STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
22 libsystem_pthread.dylib 0x185e89d34 thread_start + 8
21 libsystem_pthread.dylib 0x185e8ef94 _pthread_start + 136
20 libvlccore.9.dylib 0x10302c1e4 Run + 72 input.c:418
19 libvlccore.9.dylib 0x10302e2d4 Init + 4620 input.c:1354
18 libvlccore.9.dylib 0x103032704 es_out_PrivControl + 68 es_out.h:133
17 libvlccore.9.dylib 0x10302a1f4 PrivControl + 864 es_out_timeshift.c:828
16 libvlccore.9.dylib 0x10302aec0 CmdExecutePrivControl + 216 es_out_timeshift.c:1903
15 libvlccore.9.dylib 0x10302af10 es_out_in_PrivControl + 60 es_out_timeshift.c:489
14 libvlccore.9.dylib 0x1030212a0 EsOutPrivControl + 76 es_out.c:3998
13 libvlccore.9.dylib 0x103021900 EsOutVaPrivControlLocked + 392 es_out.c:0
12 libvlccore.9.dylib 0x1030230b4 EsOutSelect + 456 es_out.c:0
11 libvlccore.9.dylib 0x103023f64 EsOutSelectEs + 212 es_out.c:2462
10 libvlccore.9.dylib 0x10302352c EsOutCreateDecoder + 364 es_out.c:0
9 libvlccore.9.dylib 0x10301a854 decoder_New + 604 decoder.c:2207
8 libvlccore.9.dylib 0x10301c828 LoadDecoder + 200 decoder.c:0
7 libvlccore.9.dylib 0x1030078d0 module_need + 56 modules.c:272
6 libvlccore.9.dylib 0x1030077a4 vlc_module_load + 272 modules.c:233
5 libvlccore.9.dylib 0x10300797c generic_start + 68 modules.c:261
4 ??? 0x109b2151c 0x7fffffffffffffff + 9223372041312408861
3 libvlccore.9.dylib 0x10301f154 decoder_Init + 76 decoder_helpers.c:50
2 libvlccore.9.dylib 0x10306d214 es_format_Copy + 112 es_format.c:336
1 libsystem_c.dylib 0x185d26a64 strdup + 40
0 libsystem_malloc.dylib 0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148
====
1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x12008a0f0> [16]
STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
22 libsystem_pthread.dylib 0x185e89d34 thread_start + 8
21 libsystem_pthread.dylib 0x185e8ef94 _pthread_start + 136
20 libvlccore.9.dylib 0x10302c1e4 Run + 72 input.c:418
19 libvlccore.9.dylib 0x10302e2d4 Init + 4620 input.c:1354
18 libvlccore.9.dylib 0x103032704 es_out_PrivControl + 68 es_out.h:133
17 libvlccore.9.dylib 0x10302a1f4 PrivControl + 864 es_out_timeshift.c:828
16 libvlccore.9.dylib 0x10302aec0 CmdExecutePrivControl + 216 es_out_timeshift.c:1903
15 libvlccore.9.dylib 0x10302af10 es_out_in_PrivControl + 60 es_out_timeshift.c:489
14 libvlccore.9.dylib 0x1030212a0 EsOutPrivControl + 76 es_out.c:3998
13 libvlccore.9.dylib 0x103021900 EsOutVaPrivControlLocked + 392 es_out.c:0
12 libvlccore.9.dylib 0x1030230b4 EsOutSelect + 456 es_out.c:0
11 libvlccore.9.dylib 0x103023f64 EsOutSelectEs + 212 es_out.c:2462
10 libvlccore.9.dylib 0x10302352c EsOutCreateDecoder + 364 es_out.c:0
9 libvlccore.9.dylib 0x10301a854 decoder_New + 604 decoder.c:2207
8 libvlccore.9.dylib 0x10301c828 LoadDecoder + 200 decoder.c:0
7 libvlccore.9.dylib 0x1030078d0 module_need + 56 modules.c:272
6 libvlccore.9.dylib 0x1030077a4 vlc_module_load + 272 modules.c:233
5 libvlccore.9.dylib 0x10300797c generic_start + 68 modules.c:261
4 ??? 0x109b2151c 0x7fffffffffffffff + 9223372041312408861
3 libvlccore.9.dylib 0x10301f154 decoder_Init + 76 decoder_helpers.c:50
2 libvlccore.9.dylib 0x10306d214 es_format_Copy + 112 es_format.c:336
1 libsystem_c.dylib 0x185d26a64 strdup + 40
0 libsystem_malloc.dylib 0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148
====
1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x10f0f9eb0> [16]
STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
22 libsystem_pthread.dylib 0x185e89d34 thread_start + 8
21 libsystem_pthread.dylib 0x185e8ef94 _pthread_start + 136
20 libvlccore.9.dylib 0x10302c1e4 Run + 72 input.c:418
19 libvlccore.9.dylib 0x10302e2d4 Init + 4620 input.c:1354
18 libvlccore.9.dylib 0x103032704 es_out_PrivControl + 68 es_out.h:133
17 libvlccore.9.dylib 0x10302a1f4 PrivControl + 864 es_out_timeshift.c:828
16 libvlccore.9.dylib 0x10302aec0 CmdExecutePrivControl + 216 es_out_timeshift.c:1903
15 libvlccore.9.dylib 0x10302af10 es_out_in_PrivControl + 60 es_out_timeshift.c:489
14 libvlccore.9.dylib 0x1030212a0 EsOutPrivControl + 76 es_out.c:3998
13 libvlccore.9.dylib 0x103021900 EsOutVaPrivControlLocked + 392 es_out.c:0
12 libvlccore.9.dylib 0x1030230b4 EsOutSelect + 456 es_out.c:0
11 libvlccore.9.dylib 0x103023f64 EsOutSelectEs + 212 es_out.c:2462
10 libvlccore.9.dylib 0x10302352c EsOutCreateDecoder + 364 es_out.c:0
9 libvlccore.9.dylib 0x10301a854 decoder_New + 604 decoder.c:2207
8 libvlccore.9.dylib 0x10301c828 LoadDecoder + 200 decoder.c:0
7 libvlccore.9.dylib 0x1030078d0 module_need + 56 modules.c:272
6 libvlccore.9.dylib 0x1030077a4 vlc_module_load + 272 modules.c:233
5 libvlccore.9.dylib 0x10300797c generic_start + 68 modules.c:261
4 ??? 0x109b214d8 0x7fffffffffffffff + 9223372041312408793
3 libvlccore.9.dylib 0x10301f154 decoder_Init + 76 decoder_helpers.c:50
2 libvlccore.9.dylib 0x10306d214 es_format_Copy + 112 es_format.c:336
1 libsystem_c.dylib 0x185d26a64 strdup + 40
0 libsystem_malloc.dylib 0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148
====
1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x120089de0> [16]
STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
21 libsystem_pthread.dylib 0x185e89d34 thread_start + 8
20 libsystem_pthread.dylib 0x185e8ef94 _pthread_start + 136
19 libvlccore.9.dylib 0x10302c1e4 Run + 72 input.c:418
18 libvlccore.9.dylib 0x10302e2d4 Init + 4620 input.c:1354
17 libvlccore.9.dylib 0x103032704 es_out_PrivControl + 68 es_out.h:133
16 libvlccore.9.dylib 0x10302a1f4 PrivControl + 864 es_out_timeshift.c:828
15 libvlccore.9.dylib 0x10302aec0 CmdExecutePrivControl + 216 es_out_timeshift.c:1903
14 libvlccore.9.dylib 0x10302af10 es_out_in_PrivControl + 60 es_out_timeshift.c:489
13 libvlccore.9.dylib 0x1030212a0 EsOutPrivControl + 76 es_out.c:3998
12 libvlccore.9.dylib 0x103021900 EsOutVaPrivControlLocked + 392 es_out.c:0
11 libvlccore.9.dylib 0x1030230b4 EsOutSelect + 456 es_out.c:0
10 libvlccore.9.dylib 0x103023f64 EsOutSelectEs + 212 es_out.c:2462
9 libvlccore.9.dylib 0x10302352c EsOutCreateDecoder + 364 es_out.c:0
8 libvlccore.9.dylib 0x10301a854 decoder_New + 604 decoder.c:2207
7 libvlccore.9.dylib 0x10301c828 LoadDecoder + 200 decoder.c:0
6 libvlccore.9.dylib 0x1030078d0 module_need + 56 modules.c:272
5 libvlccore.9.dylib 0x1030077a4 vlc_module_load + 272 modules.c:233
4 libvlccore.9.dylib 0x10300797c generic_start + 68 modules.c:261
3 ??? 0x109b214a4 0x7fffffffffffffff + 9223372041312408741
2 libvlccore.9.dylib 0x10306d214 es_format_Copy + 112 es_format.c:336
1 libsystem_c.dylib 0x185d26a64 strdup + 40
0 libsystem_malloc.dylib 0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148
====
1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x120088240> [16]
STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
22 libsystem_pthread.dylib 0x185e89d34 thread_start + 8
21 libsystem_pthread.dylib 0x185e8ef94 _pthread_start + 136
20 libvlccore.9.dylib 0x10302c1e4 Run + 72 input.c:418
19 libvlccore.9.dylib 0x10302e2d4 Init + 4620 input.c:1354
18 libvlccore.9.dylib 0x103032704 es_out_PrivControl + 68 es_out.h:133
17 libvlccore.9.dylib 0x10302a1f4 PrivControl + 864 es_out_timeshift.c:828
16 libvlccore.9.dylib 0x10302aec0 CmdExecutePrivControl + 216 es_out_timeshift.c:1903
15 libvlccore.9.dylib 0x10302af10 es_out_in_PrivControl + 60 es_out_timeshift.c:489
14 libvlccore.9.dylib 0x1030212a0 EsOutPrivControl + 76 es_out.c:3998
13 libvlccore.9.dylib 0x103021900 EsOutVaPrivControlLocked
2 years ago
Steve Lhomme
b09808a6cf
vpx_alpha: handle bitstreams with intermittent alpha content
It seems some sources set the alpha flag but don't always attach an alpha layer to each frame.
Ref #28653
2 years ago
Steve Lhomme
a6d32f4f95
vpx_alpha: don't lock while the decoders are flushing
They may call FormatUpdate (lavc) and other things that lock.
We don't need a lock on the decoder as it cannot change during the
lifetime of our pseudo-decoder.
2 years ago
Steve Lhomme
f95c9c6aa6
vpx_alpha: support D3D11 combined planes
3 years ago
Steve Lhomme
bc8308fd6e
codec: fix i_level -1 detected as VPx with alpha
2 years ago
Steve Lhomme
f5556fb02a
vpx_alpha: fix infinite loop when opening sub decoders
2 years ago
Steve Lhomme
27350e784c
codec: add a pseudo-decoder for VP8/VP9 with alpha
It uses 2 decoders in parallel and then merges the planes on output.
Only software decoders are supported for now.
3 years ago