MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / validate_avframe_allocation

Function validate_avframe_allocation

libavcodec/decode.c:1618–1637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1616}
1617
1618static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
1619{
1620 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
1621 int i;
1622 int num_planes = av_pix_fmt_count_planes(frame->format);
1623 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
1624 int flags = desc ? desc->flags : 0;
1625 if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
1626 num_planes = 2;
1627 for (i = 0; i < num_planes; i++) {
1628 av_assert0(frame->data[i]);
1629 }
1630 // For formats without data like hwaccel allow unused pointers to be non-NULL.
1631 for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) {
1632 if (frame->data[i])
1633 av_log(avctx, AV_LOG_ERROR, "Buffer returned by get_buffer2() did not zero unused plane pointers\n");
1634 frame->data[i] = NULL;
1635 }
1636 }
1637}
1638
1639static void decode_data_free(AVRefStructOpaque unused, void *obj)
1640{

Callers 2

attach_post_process_dataFunction · 0.85
ff_get_bufferFunction · 0.85

Calls 3

av_pix_fmt_count_planesFunction · 0.85
av_pix_fmt_desc_getFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected