diff mbox

[FFmpeg-devel] cuvid: Always check for internal errors during parsing

Message ID 1473537061-28490-1-git-send-email-philipl@overt.org
State Accepted
Commit 4029f05c8b0943a5446f254142d5e2bfedb50a0d
Headers show

Commit Message

Philip Langdale Sept. 10, 2016, 7:51 p.m. UTC
The cuvid parser is basically undocumented, and although you'd
think that a failed callback would result in the overall parse
call returning an error, that is not true.

So, we end up silently trying to keep going as if nothing is wrong,
which doesn't achieve anything.

Solution: check the internal error flag every time.
Signed-off-by: Philip Langdale <philipl@overt.org>
---
 libavcodec/cuvid.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Timo Rothenpieler Sept. 10, 2016, 8:41 p.m. UTC | #1
On 9/10/2016 9:51 PM, Philip Langdale wrote:
> The cuvid parser is basically undocumented, and although you'd
> think that a failed callback would result in the overall parse
> call returning an error, that is not true.
> 
> So, we end up silently trying to keep going as if nothing is wrong,
> which doesn't achieve anything.
> 
> Solution: check the internal error flag every time.
> Signed-off-by: Philip Langdale <philipl@overt.org>

applied
diff mbox

Patch

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index de75960..19a7772 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -272,8 +272,13 @@  static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     av_packet_unref(&filtered_packet);
 
     if (ret < 0) {
-        if (ctx->internal_error)
-            ret = ctx->internal_error;
+        goto error;
+    }
+
+    // cuvidParseVideoData doesn't return an error just because stuff failed...
+    if (ctx->internal_error) {
+        av_log(avctx, AV_LOG_ERROR, "cuvid decode callback error\n");
+        ret = ctx->internal_error;
         goto error;
     }