stagefright: fix potential codec leaks in async stop/reset
Currently if stop is followed by a reset from another thread, we unblock the stop first (to avoid ANR) without waiting for kWhatShutdownCompleted, and proceed with the reset request. But this could cause release to return too early when the kWhatShutdownCompleted for the stop is received. When this happens, the reset() will unregister ACodec's handlers before the real shutdown with deallocation is processed, causing a codec node instance to be leaked. To solve this problem, separate kWhatShutdownCompleted into two messages kWhatStopCompleted and kWhatReleaseCompleted. Release should only return upon kWhatReleaseCompleted. Also initializing the fence fd in the metadata buffer (even though it's not used) to avoid warning in freeBuffer. bug: 32750454 bug: 32971559 Change-Id: If218c853955729a2a2f2e8356908115a79c442e3
Loading
Please register or sign in to comment