Backport of "avaudenc/avvidenc: Reopen encoding session if it's required" into 1.16
Backport of !99 (merged) "avaudenc/avvidenc: Reopen encoding session if it's required".
Commits:
- 89bb244a avaudenc/avvidenc: Reopen encoding session if it's required