Commit 10ef73dc authored by Felix Abecassis's avatar Felix Abecassis Committed by Martin Storsjö

mediacodec: try to return an output frame if we failed to get an available input buffer.

Previously we would only return one frame even if multiple output
frames were available, dropping all but the last one, while waiting
for a free input buffer. Instead return the first output buffer
and don't consume the input buffer at all in that case.
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 2a5ae456
......@@ -536,7 +536,16 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
while (true) {
int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout);
if (index < 0) {
GetOutput(p_dec, env, &p_pic, timeout > 0);
GetOutput(p_dec, env, &p_pic, 0);
if (p_pic) {
/* If we couldn't get an available input buffer but a
* decoded frame is available, we return the frame
* without assigning NULL to *pp_block. The next call
* to DecodeVideo will try to send the input packet again.
*/
(*myVm)->DetachCurrentThread(myVm);
return p_pic;
}
timeout = 30;
continue;
}
......
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