mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mpegvideo: fix allocation of the hwaccel_picture_private data
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
1516bf7af1
commit
4e70d66ded
@ -269,11 +269,12 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
|
|||||||
if (s->avctx->hwaccel) {
|
if (s->avctx->hwaccel) {
|
||||||
assert(!pic->hwaccel_picture_private);
|
assert(!pic->hwaccel_picture_private);
|
||||||
if (s->avctx->hwaccel->priv_data_size) {
|
if (s->avctx->hwaccel->priv_data_size) {
|
||||||
pic->hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
|
pic->hwaccel_priv_buf = av_buffer_allocz(s->avctx->hwaccel->priv_data_size);
|
||||||
if (!pic->hwaccel_picture_private) {
|
if (!pic->hwaccel_priv_buf) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
|
av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +294,8 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
|
|||||||
if (r < 0 || !pic->f.data[0]) {
|
if (r < 0 || !pic->f.data[0]) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %p)\n",
|
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %p)\n",
|
||||||
r, pic->f.data[0]);
|
r, pic->f.data[0]);
|
||||||
av_freep(&pic->hwaccel_picture_private);
|
av_buffer_unref(&pic->hwaccel_priv_buf);
|
||||||
|
pic->hwaccel_picture_private = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user