summaryrefslogtreecommitdiff
path: root/libavcodec/qsvdec_other.c
diff options
context:
space:
mode:
authorLinjie Fu <linjie.fu@intel.com>2018-10-16 09:36:13 +0800
committerZhong Li <zhong.li@intel.com>2018-11-06 17:42:29 +0800
commit87368884a52b09eef96190ff1654d56591ec7038 (patch)
tree557e1e78f2e4cc678f18173970d04fc1fd9548f8 /libavcodec/qsvdec_other.c
parentbeaa350e24167f4ff31275a6114693f5ce7cd409 (diff)
lavc/qsvdec: flush buffered data before reinit
Flush the buffered data in libmfx before video param reinit in case the frames drop. Cache the first frame causing the reinit and decode zero-size pkt to flush the buffered pkt before reinit. After all the buffered pkts being flushed, resume to reinit and decode. Fix the issue in ticket #7399. [V2]: Move the definition of zero_pkt to where it is exactly used. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
Diffstat (limited to 'libavcodec/qsvdec_other.c')
-rw-r--r--libavcodec/qsvdec_other.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
index 993c7a8e80..03251d2c85 100644
--- a/libavcodec/qsvdec_other.c
+++ b/libavcodec/qsvdec_other.c
@@ -132,9 +132,11 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
/* no more data */
if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket))
return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt);
-
- av_packet_unref(&s->input_ref);
- av_fifo_generic_read(s->packet_fifo, &s->input_ref, sizeof(s->input_ref), NULL);
+ /* in progress of reinit, no read from fifo and keep the buffer_pkt */
+ if (!s->qsv.reinit_flag) {
+ av_packet_unref(&s->input_ref);
+ av_fifo_generic_read(s->packet_fifo, &s->input_ref, sizeof(s->input_ref), NULL);
+ }
}
ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->input_ref);
@@ -145,6 +147,8 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
return ret;
}
+ if (s->qsv.reinit_flag)
+ continue;
s->input_ref.size -= ret;
s->input_ref.data += ret;