CCodec: Update watchdog to handle timeouts accurately
Update initiateReleaseIfStuck function to decide timeout just before calling onError. This avoids some cases where an event (e.g., configure) is decided as timed out by this thread immediately after function entry. But when the thread is waiting for mConfig lock, configure function actually returns successfully, which moves the MediaCodec to valid CONFIGURED state. But since the watchdog thread has already decided that configure function has timed out, it calls onError callback to MediaCodec. This moves the MediaCodec state to UNINTIALIZED after the configure function was successful. This chain of events creates problem when clients like nuplayer tries to perform some action on MediaCodec after configure was successful (but MediaCodec is nor in CONFIGURED state, due to above onError callback). So, watchdog thread should check for function timeout just before calling onError callback to avoid such race conditions. Bug: 245494175 Change-Id: I6a7d250c7475cb40d25775bfc56ff6c13239afb8
Loading
Please register or sign in to comment