Ticket #13233: 20180614_1707_ffmpeg_aman_revert.patch

File 20180614_1707_ffmpeg_aman_revert.patch, 1.7 KB (added by Peter Bennett, 3 years ago)

Aman's not yet released ffmpeg fix. Apply separately from other patch.

  • libavcodec/mediacodecdec_common.c

    diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
    index 40a2ee6778..887865a281 100644
    a b static int mediacodec_dec_flush_codec(AVCodecContext *avctx, MediaCodecDecContex 
    443443    FFAMediaCodec *codec = s->codec;
    444444    int status;
    445445
     446    s->output_buffer_count = 0;
     447
    446448    s->draining = 0;
    447449    s->flushing = 0;
    448450    s->eos = 0;
    int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, 
    670672        /* If the codec is flushing or need to be flushed, block for a fair
    671673         * amount of time to ensure we got a frame */
    672674        output_dequeue_timeout_us = OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US;
    673     } else if (!wait) {
     675    } else if (s->output_buffer_count == 0 || !wait) {
     676        /* If the codec hasn't produced any frames, do not block so we
     677         * can push data to it as fast as possible, and get the first
     678         * frame */
    674679        output_dequeue_timeout_us = 0;
    675680    }
    676681
    int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, 
    704709                }
    705710            }
    706711
     712            s->output_buffer_count++;
    707713            return 0;
    708714        } else {
    709715            status = ff_AMediaCodec_releaseOutputBuffer(codec, index, 0);
  • libavcodec/mediacodecdec_common.h

    diff --git a/libavcodec/mediacodecdec_common.h b/libavcodec/mediacodecdec_common.h
    index d280236b8e..0b21129fee 100644
    a b typedef struct MediaCodecDecContext { 
    6464    int display_width;
    6565    int display_height;
    6666
     67    uint64_t output_buffer_count;
    6768    ssize_t current_input_buffer;
    6869
    6970    bool delay_flush;