mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-19 05:49:09 +02:00
avcodec/mediacodecdec: clarify delay_flush specific code
As of 2a0eb8685, ff_mediacodec_dec_is_flushing() only returns true in delay_flush mode. Make this more obvious by adding delay_flush to the if statement. Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Aman Gupta <aman@tmm1.net> (cherry picked from commit 6a7a84b2d11e6c5e2ca2023a6886ca75b8b10030)
This commit is contained in:
parent
2884575d97
commit
84bf631018
@ -419,27 +419,9 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||||||
MediaCodecH264DecContext *s = avctx->priv_data;
|
MediaCodecH264DecContext *s = avctx->priv_data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/* In delay_flush mode, wait until the user has released or rendered
|
||||||
* MediaCodec.flush() discards both input and output buffers, thus we
|
all retained frames. */
|
||||||
* need to delay the call to this function until the user has released or
|
if (s->delay_flush && ff_mediacodec_dec_is_flushing(avctx, s->ctx)) {
|
||||||
* renderered the frames he retains.
|
|
||||||
*
|
|
||||||
* After we have buffered an input packet, check if the codec is in the
|
|
||||||
* flushing state. If it is, we need to call ff_mediacodec_dec_flush.
|
|
||||||
*
|
|
||||||
* ff_mediacodec_dec_flush returns 0 if the flush cannot be performed on
|
|
||||||
* the codec (because the user retains frames). The codec stays in the
|
|
||||||
* flushing state.
|
|
||||||
*
|
|
||||||
* ff_mediacodec_dec_flush returns 1 if the flush can actually be
|
|
||||||
* performed on the codec. The codec leaves the flushing state and can
|
|
||||||
* process again packets.
|
|
||||||
*
|
|
||||||
* ff_mediacodec_dec_flush returns a negative value if an error has
|
|
||||||
* occurred.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if (ff_mediacodec_dec_is_flushing(avctx, s->ctx)) {
|
|
||||||
if (!ff_mediacodec_dec_flush(avctx, s->ctx)) {
|
if (!ff_mediacodec_dec_flush(avctx, s->ctx)) {
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
}
|
}
|
||||||
|
@ -764,6 +764,18 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s,
|
|||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ff_mediacodec_dec_flush returns 0 if the flush cannot be performed on
|
||||||
|
* the codec (because the user retains frames). The codec stays in the
|
||||||
|
* flushing state.
|
||||||
|
*
|
||||||
|
* ff_mediacodec_dec_flush returns 1 if the flush can actually be
|
||||||
|
* performed on the codec. The codec leaves the flushing state and can
|
||||||
|
* process again packets.
|
||||||
|
*
|
||||||
|
* ff_mediacodec_dec_flush returns a negative value if an error has
|
||||||
|
* occurred.
|
||||||
|
*/
|
||||||
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
|
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
|
||||||
{
|
{
|
||||||
if (!s->surface || atomic_load(&s->refcount) == 1) {
|
if (!s->surface || atomic_load(&s->refcount) == 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user