FFmpegVideoDecoder leaks reference to ANativeWindow
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox161 | --- | fixed |
People
(Reporter: aosmond, Assigned: aosmond)
References
(Blocks 4 open bugs)
Details
Attachments
(1 external file)
We supply AVMediaCodecDeviceContext an ANativeWindow pointer in native_window at initialization of a MediaCodec decoder:
https://searchfox.org/firefox-main/rev/efd2d1e6f77570ae6bc5294731a68101e45c81a3/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp#3205
https://searchfox.org/firefox-main/rev/efd2d1e6f77570ae6bc5294731a68101e45c81a3/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp#3223
It looks like we free it when we free the context:
https://searchfox.org/firefox-main/rev/efd2d1e6f77570ae6bc5294731a68101e45c81a3/media/ffvpx/libavutil/hwcontext_mediacodec.c#99-102
But that is misleading because it has a condition just above it:
https://searchfox.org/firefox-main/rev/efd2d1e6f77570ae6bc5294731a68101e45c81a3/media/ffvpx/libavutil/hwcontext_mediacodec.c#96
That is only satisfied if set libmedia in mc_device_init
https://searchfox.org/firefox-main/rev/efd2d1e6f77570ae6bc5294731a68101e45c81a3/media/ffvpx/libavutil/hwcontext_mediacodec.c#79
Which we won't due to the early return since we already set native_window
https://searchfox.org/firefox-main/rev/efd2d1e6f77570ae6bc5294731a68101e45c81a3/media/ffvpx/libavutil/hwcontext_mediacodec.c#71-72
| Assignee | ||
Comment 1•14 days ago
|
||
FFmpeg only releases AVMediaCodecDeviceContext::native_window if it created
the window itself, which it never does for us because we always provide one.
Release our reference from the device context's free callback, which runs once
the last reference to the context is dropped, including on init failure.
Comment 3•13 days ago
|
||
| bugherder | ||
Updated•13 days ago
|
Description
•