MediaCodec multi-threaded reference
<p>There are two threads to access the same <code>MediaCodec</code> object, and they may need to run simultaneously. Now I have a problem: when the two threads are running at the same time, the code is following:</p>

<pre><code>try {
   mediaCodec.releaseOutputBuffer(encoderStatus, false);
} catch (IllegalStateException e) {
    e.printStackTrace();
}
</code></pre>

<p>How to deal with this code?</p>

<p>Because the two threads reference to the same mediaCodec object, one thread executes this code will affect the other thread's reference to the <code>mediaCodec</code>, and the other thread cannot run normally. How to solve it?</p>