Various mediacodec fixes

/cc @davilla