+ if (!cuvid_is_buffer_full(avctx)) {
+ AVPacket pkt = {0};
+ ret = ff_decode_get_packet(avctx, &pkt);
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+ ret = cuvid_decode_packet(avctx, &pkt);
+ av_packet_unref(&pkt);
+ // cuvid_is_buffer_full() should avoid this.
+ if (ret == AVERROR(EAGAIN))
+ ret = AVERROR_EXTERNAL;
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+ }
+