Video encoding, safe restart on abort.

I want to implement shutdown and restart in my encoder api upon receiving an abort.

Currently I’m trying to wait for all buffers dequeued in capture plane, then deinit output/capture planes, after that I’m cleaning everything at cleanup phase.

Problem is I’m getting timeout while waiting capture plane dq thread.

How can i safely remove every thread, class etc that nvidia uses and deinit everything? Please help me through few steps.

We have tegra_multimedia_api sample for demonstrating video encoding. Please take a look at