Commit 379b88fa authored by François Grisez's avatar François Grisez

MediaCodecDecoder: restart the decoding session should...

MediaCodecDecoder: restart the decoding session should AMediaCodec_dequeueOutputBuffer() return AMEDIA_ERROR_UNKNOWN.

This status code means that the underlaying Java object has thrown an exception. The decoding session
is often invalid in this situation and needs to be restarted.
parent 3178a623
......@@ -144,6 +144,16 @@ MediaCodecDecoder::Status MediaCodecDecoder::fetch(mblk_t *&frame) {
return noFrameAvailable;
} else {
ms_error("MediaCodecDecoder: error while dequeueing an output buffer: %s", codecInfoToString(oBufidx).c_str());
if (oBufidx == AMEDIA_ERROR_UNKNOWN) {
try {
ms_message("MdeiaCodecDecoder: restarting decoding session");
stopImpl();
startImpl();
} catch (const runtime_error &e) {
ms_error("MediaCodecDecoder: session restart failed. %s", e.what());
ms_error("MediaCodecDecoder: the session is definitively lost !");
}
}
return decodingFailure;
}
goto end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment