[FFmpeg-devel,6/6] avcodec/mediacodecdec_common: propagate EOF immediately when signaled by decoder

Submitted by Aman Gupta on Sept. 5, 2019, 6:27 p.m.

Details

Message ID 20190905182735.65987-6-ffmpeg@tmm1.net
State New
Headers show

Commit Message

Aman Gupta Sept. 5, 2019, 6:27 p.m.
From: Aman Gupta <aman@tmm1.net>

Signed-off-by: Aman Gupta <aman@tmm1.net>
---
 libavcodec/mediacodecdec_common.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthieu Bouron Sept. 6, 2019, 7:47 a.m.
On Thu, Sep 05, 2019 at 11:27:35AM -0700, Aman Gupta wrote:
> From: Aman Gupta <aman@tmm1.net>
> 
> Signed-off-by: Aman Gupta <aman@tmm1.net>
> ---
>  libavcodec/mediacodecdec_common.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
> index b9465244a3..ab8525fb14 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -693,6 +693,7 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s,
>  
>          if (info.flags & ff_AMediaCodec_getBufferFlagEndOfStream(codec)) {
>              s->eos = 1;
> +            return AVERROR_EOF;
>          }

I am not sure it will work in all cases / all devices as we probably can
end up with a proper output buffer with the OES flag. Returning
AVERROR_EOF here will discard such buffer (frame).

>  
>          if (info.size) {
> -- 
> 2.20.1
>

Patch hide | download patch | download mbox

diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index b9465244a3..ab8525fb14 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -693,6 +693,7 @@  int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s,
 
         if (info.flags & ff_AMediaCodec_getBufferFlagEndOfStream(codec)) {
             s->eos = 1;
+            return AVERROR_EOF;
         }
 
         if (info.size) {