msdkenc: fix leaks on windows
commit ce2a94f5:
msdk: Use gst_clear_object()
`gst_object_replace()` is not supposed to be used for unreffing and
NULLing objects.
commit 2c4c9828:
msdk: Fix warning about unused variable on Windows
commit 4384dbd8:
msdk: Reorganize context preparation code
Split it out into a separate function with early exits to make the
flow clearer, and document what the function is doing clearly.
No functional changes.
commit b64693fe:
msdk: Fix increasing memory usage in dynamic pipelines
Our context is non-persistent, and we propagate it throughout the
pipeline. This means that if we try to reuse any gstmsdk element by
removing it from the pipeline and then re-adding it, we'll clone the
mfxSession and create a new gstmsdk context as a child of the old one
inside `gst_msdk_context_new_with_parent()`.
Normally this only allocates a few KB inside the driver, but on
Windows it seems to allocate tens of MBs which leads to linearly
increasing memory usage for each PLAYING->NULL->PLAYING state cycle
for the process. The contexts will only be freed when the pipeline
itself goes to `NULL`, which would defeat the purpose of dynamic
pipelines.
Essentially, we need to optimize the case in which the element is
removed from the pipeline and re-added and the same context is re-set
on it. To detect that case, we set the context on `old_context`, and
compare it to the new one when preparing the context. If they're the
same, we don't need to do anything.
Fixes #946 (closed)
Merge request reports
Activity
added 1.16 Needs backport labels
added Windows label
mentioned in issue #946 (closed)
added 1 commit
- 1dd3fb27 - msdk: Fix increasing memory usage in dynamic pipelines
mentioned in merge request !987 (merged)
removed Needs backport label
added Memory label
added Backported into 1.16 label
- Resolved by Nirbheek Chauhan
- Resolved by Nirbheek Chauhan
- Resolved by Nirbheek Chauhan
added 22 commits
-
6ec15d5f...0c39068c - 18 commits from branch
gstreamer:master
- 6a847f73 - msdk: Use gst_clear_object()
- fc200e08 - msdk: Fix warning about unused variable on Windows
- bf36fbfc - msdk: Reorganize context preparation code
- 04aa692c - msdk: Fix increasing memory usage in dynamic pipelines
Toggle commit list-
6ec15d5f...0c39068c - 18 commits from branch
- Resolved by Haihao Xiang
LGTM! Could you submit a PR to https://github.com/intel-media-ci/gst-plugins-bad as well? It will do some pre-check and make sure no regression will be introduced (currently it is for Linux only).
added 7 commits
-
04aa692c...bda68734 - 3 commits from branch
gstreamer:master
- c0d778c2 - msdk: Use gst_clear_object()
- e83d5fd8 - msdk: Fix warning about unused variable on Windows
- 6834a121 - msdk: Reorganize context preparation code
- 1bcf44bb - msdk: Fix increasing memory usage in dynamic pipelines
Toggle commit list-
04aa692c...bda68734 - 3 commits from branch
assigned to @gstreamer-merge-bot
changed milestone to %1.17.1