mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 18:05:21 +00:00
f_decoder_wrapper: retry decoding if libavcodec returns invalid state
At least the libavcodec MediaCodec wrapper sometimes seems to break the libavcodec API, and does the following sequence: send_packet() -> EAGAIN receive_frame() -> EAGAIN send_packet() -> OK The libavcodec API never allows returning EAGAIN from both functions, so we discarded packets in this case. Change it to retrying decoding, for the sake of MediaCodec. Note that it could also happen due to internal bugs in the vd_lavc.c hw fallback code, but if there are any remaining, they should be fixed properly instead. Requested.
This commit is contained in:
parent
f81ae9c3fc
commit
0b4120919a
@ -710,8 +710,13 @@ void lavc_process(struct mp_filter *f, bool *eof_flag,
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!send(f, pkt))
|
||||
MP_WARN(f, "could not consume packet\n"); // should never happen
|
||||
if (!send(f, pkt)) {
|
||||
// Should never happen, but can happen with broken decoders.
|
||||
MP_WARN(f, "could not consume packet\n");
|
||||
mp_pin_out_unread(f->ppins[0], frame);
|
||||
mp_filter_wakeup(f);
|
||||
return;
|
||||
}
|
||||
talloc_free(pkt);
|
||||
mp_filter_internal_mark_progress(f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user