diff mbox

[FFmpeg-devel,2/2] cuvid: Check for non 420 chroma formats - they aren't supported

Message ID 1473908168-31888-3-git-send-email-philipl@overt.org
State Accepted
Commit ee88dcb2b0fefb42b0761ddb105c71daf604d791
Headers show

Commit Message

Philip Langdale Sept. 15, 2016, 2:56 a.m. UTC
Despite the video parser seeming to correctly handle 422 and 444
chroma formats, the video decoder fails miserably to actually
decode frames - even though no errors are ever returned; you just
get frames showing unintialized garbage.

Signed-off-by: Philip Langdale <philipl@overt.org>
---
 libavcodec/cuvid.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 880a572..8f3efec 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -137,6 +137,12 @@  static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form
         return 0;
     }
 
+    if (format->chroma_format != cudaVideoChromaFormat_420) {
+        av_log(avctx, AV_LOG_ERROR, "Chroma formats other than 420 are not supported\n");
+        ctx->internal_error = AVERROR(EINVAL);
+        return 0;
+    }
+
     avctx->coded_width = format->coded_width;
     avctx->coded_height = format->coded_height;