[MediaCodec] Fix the bug of callback registration (#941)