diff options
author | Aman Gupta <aman@tmm1.net> | 2019-09-05 11:20:40 -0700 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2019-09-09 13:25:06 -0700 |
commit | ca613dcc387ed2ad8c7f12e8e8f972a7c57daec8 (patch) | |
tree | 771fc68d503b58dc39c6bc364a529588de66bf4a | |
parent | f821d1953151ea7b7f1e1eb96ac72529477b021a (diff) | |
download | ffmpeg-ca613dcc387ed2ad8c7f12e8e8f972a7c57daec8.tar.gz |
avcodec/mediacodecdec_common: ensure current input buffer is always used correctly
The loop may mutate the input buffer, so re-fetch it to ensure
the current one is always used.
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
-rw-r--r-- | libavcodec/mediacodecdec_common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index 9005adc1f3..c4e87e270f 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -569,7 +569,6 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, int offset = 0; int need_draining = 0; uint8_t *data; - ssize_t index = s->current_input_buffer; size_t size; FFAMediaCodec *codec = s->codec; int status; @@ -591,6 +590,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, } while (offset < pkt->size || (need_draining && !s->draining)) { + ssize_t index = s->current_input_buffer; if (index < 0) { index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us); if (ff_AMediaCodec_infoTryAgainLater(codec, index)) { |