Fix memory issues with HybrisMediaCodecVideoDecoder
- Wherever we post a task to a task runner, pass a weak pointer of
this
instead of usingbase::Unretained()
. SinceVideoDecoder
base class is not a ref-counted class, a weak reference is the best we can do. - To make sure a destruction in one thread doesn't race with another thread accessing the object, do the destruction in a different thread the destruction is requested, but after we prevent further callbacks from accessing the object in such thread.
- Remove extra call to
surface_texture_client_ref()
. The cause of the crash without it is now fixed in libhybris, and thus this extra call is not needed. In fact, with fixed libhybris this extra call will leak memory.
Bug: #11 (closed)