Commit 85766391 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

mediacodec: don't loop in GetOutput

DecodeVideo is already looping.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9d997cdf
...@@ -849,7 +849,6 @@ static int PutInput(decoder_t *p_dec, JNIEnv *env, block_t **pp_block, jlong tim ...@@ -849,7 +849,6 @@ static int PutInput(decoder_t *p_dec, JNIEnv *env, block_t **pp_block, jlong tim
static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong timeout) static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong timeout)
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
while (1) {
int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_output_buffer, int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_output_buffer,
p_sys->buffer_info, timeout); p_sys->buffer_info, timeout);
if (CHECK_EXCEPTION()) { if (CHECK_EXCEPTION()) {
...@@ -860,25 +859,14 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti ...@@ -860,25 +859,14 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
if (index >= 0) { if (index >= 0) {
if (!p_sys->pixel_format) { if (!p_sys->pixel_format) {
msg_Warn(p_dec, "Buffers returned before output format is set, dropping frame"); msg_Warn(p_dec, "Buffers returned before output format is set, dropping frame");
if (ReleaseOutputBuffer(p_dec, env, index, false) != 0) return ReleaseOutputBuffer(p_dec, env, index, false);
return -1;
continue;
} }
if (!*pp_pic) {
*pp_pic = decoder_NewPicture(p_dec); *pp_pic = decoder_NewPicture(p_dec);
} else if (p_sys->direct_rendering) { if (!*pp_pic) {
picture_t *p_pic = *pp_pic; msg_Warn(p_dec, "NewPicture failed");
picture_sys_t *p_picsys = p_pic->p_sys; return ReleaseOutputBuffer(p_dec, env, index, false);
int i_prev_index = p_picsys->priv.hw.i_index;
if (ReleaseOutputBuffer(p_dec, env, i_prev_index, false) != 0)
return -1;
// No need to lock here since the previous picture was not sent.
InsertInflightPicture(p_dec, NULL, i_prev_index);
} }
if (*pp_pic) {
picture_t *p_pic = *pp_pic; picture_t *p_pic = *pp_pic;
/* If the oldest input block had no PTS, the timestamp /* If the oldest input block had no PTS, the timestamp
* of the frame returned by MediaCodec might be wrong * of the frame returned by MediaCodec might be wrong
...@@ -934,17 +922,10 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti ...@@ -934,17 +922,10 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
} }
(*env)->DeleteLocalRef(env, buf); (*env)->DeleteLocalRef(env, buf);
} }
} else {
msg_Warn(p_dec, "NewPicture failed");
if (ReleaseOutputBuffer(p_dec, env, index, false) != 0)
return -1;
}
return 0;
} else if (index == INFO_OUTPUT_BUFFERS_CHANGED) { } else if (index == INFO_OUTPUT_BUFFERS_CHANGED) {
msg_Dbg(p_dec, "output buffers changed"); msg_Dbg(p_dec, "output buffers changed");
if (!p_sys->get_output_buffers) if (!p_sys->get_output_buffers)
continue; return 0;
(*env)->DeleteGlobalRef(env, p_sys->output_buffers); (*env)->DeleteGlobalRef(env, p_sys->output_buffers);
p_sys->output_buffers = (*env)->CallObjectMethod(env, p_sys->codec, p_sys->output_buffers = (*env)->CallObjectMethod(env, p_sys->codec,
...@@ -1019,10 +1000,6 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti ...@@ -1019,10 +1000,6 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
p_sys->slice_height = 0; p_sys->slice_height = 0;
p_sys->stride = p_dec->fmt_out.video.i_width; p_sys->stride = p_dec->fmt_out.video.i_width;
} }
} else {
return 0;
}
} }
return 0; return 0;
} }
......
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