You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/encode: add missing assert to avcodec_receive_packet()
Encoders must return reference counted packets. This was checked only for encoders using the AVCodec->encode2() API, while blindly accepting whatever encoders using the AVCodec->receive_packet() API were returning. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -428,9 +428,15 @@ int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket *
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
if (avctx->codec->receive_packet) {
|
if (avctx->codec->receive_packet) {
|
||||||
|
int ret;
|
||||||
if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
|
if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
return avctx->codec->receive_packet(avctx, avpkt);
|
ret = avctx->codec->receive_packet(avctx, avpkt);
|
||||||
|
if (!ret)
|
||||||
|
// Encoders must always return ref-counted buffers.
|
||||||
|
// Side-data only packets have no data and can be not ref-counted.
|
||||||
|
av_assert0(!avpkt->data || avpkt->buf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emulation via old API.
|
// Emulation via old API.
|
||||||
|
Reference in New Issue
Block a user