On 4/23/2017 7:00 PM, Michael Niedermayer wrote:
On Sat, Apr 22, 2017 at 11:32:41PM +0000, James Almer wrote:
ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Sat Apr 22 20:08:42 
2017 -0300| [bddb2343b6e594e312dadb5d21b408702929ae04] | committer: James Almer

Merge commit '061a0c14bb5767bca72e3a7227ca400de439ba09'

* commit '061a0c14bb5767bca72e3a7227ca400de439ba09':
   decode: restructure the core decoding code

CUVID decoder adapted by wm4.

Merged-by: James Almer <jamr...@gmail.com>

[...]

+static int compat_decode(AVCodecContext *avctx, AVFrame *frame,
+                         int *got_frame, const AVPacket *pkt)
+{
+    AVCodecInternal *avci = avctx->internal;
+    int ret;
+
+    av_assert0(avci->compat_decode_consumed == 0);
+
+    *got_frame = 0;
+    avci->compat_decode = 1;
+
+    if (avci->compat_decode_partial_size > 0 &&
+        avci->compat_decode_partial_size != pkt->size) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Got unexpected packet size after a partial decode\n");
+        ret = AVERROR(EINVAL);
+        goto finish;
+    }
+
+    if (!avci->compat_decode_partial_size) {
+        ret = avcodec_send_packet(avctx, pkt);
+        if (ret == AVERROR_EOF)
+            ret = 0;
+        else if (ret == AVERROR(EAGAIN)) {
+            /* we fully drain all the output in each decode call, so this 
should not
+             * ever happen */
+            ret = AVERROR_BUG;
+            goto finish;
+        } else if (ret < 0)
+            goto finish;
+    }
+

+    while (ret >= 0) {

ret is uninitialized if compat_decode_partial_size != 0

Cherry picked a libav commit far away in the queue that dealt
with this.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to