Fix crash when using this decoder for unsupported format on some version
of OS X.
... | ... |
@@ -235,6 +235,16 @@ static av_cold int vdadec_init(AVCodecContext *avctx) |
235 | 235 |
} |
236 | 236 |
ctx->h264_initialized = 1; |
237 | 237 |
|
238 |
+ for (int i = 0; i < MAX_SPS_COUNT; i++) { |
|
239 |
+ SPS *sps = ctx->h264ctx.sps_buffers[i]; |
|
240 |
+ if (sps && (sps->bit_depth_luma != 8 || |
|
241 |
+ sps->chroma_format_idc == 2 || |
|
242 |
+ sps->chroma_format_idc == 3)) { |
|
243 |
+ av_log(avctx, AV_LOG_ERROR, "Format is not supported.\n"); |
|
244 |
+ goto failed; |
|
245 |
+ } |
|
246 |
+ } |
|
247 |
+ |
|
238 | 248 |
return 0; |
239 | 249 |
|
240 | 250 |
failed: |