Merge commit 'c3ebfcd6e1327ca7bbcaee822e593c2da6cfd352'
* commit 'c3ebfcd6e1327ca7bbcaee822e593c2da6cfd352': mpegvideo: allocate hwaccel privdata after the frame buffer h264: allocate hwaccel privdata after the frame buffer Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
f7fee8f700
@ -343,6 +343,15 @@ static int alloc_picture(H264Context *h, Picture *pic)
|
|||||||
|
|
||||||
av_assert0(!pic->f.data[0]);
|
av_assert0(!pic->f.data[0]);
|
||||||
|
|
||||||
|
pic->tf.f = &pic->f;
|
||||||
|
ret = ff_thread_get_buffer(h->avctx, &pic->tf, pic->reference ?
|
||||||
|
AV_GET_BUFFER_FLAG_REF : 0);
|
||||||
|
if (ret < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
h->linesize = pic->f.linesize[0];
|
||||||
|
h->uvlinesize = pic->f.linesize[1];
|
||||||
|
|
||||||
if (h->avctx->hwaccel) {
|
if (h->avctx->hwaccel) {
|
||||||
const AVHWAccel *hwaccel = h->avctx->hwaccel;
|
const AVHWAccel *hwaccel = h->avctx->hwaccel;
|
||||||
av_assert0(!pic->hwaccel_picture_private);
|
av_assert0(!pic->hwaccel_picture_private);
|
||||||
@ -353,14 +362,6 @@ static int alloc_picture(H264Context *h, Picture *pic)
|
|||||||
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
|
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pic->tf.f = &pic->f;
|
|
||||||
ret = ff_thread_get_buffer(h->avctx, &pic->tf, pic->reference ?
|
|
||||||
AV_GET_BUFFER_FLAG_REF : 0);
|
|
||||||
if (ret < 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
h->linesize = pic->f.linesize[0];
|
|
||||||
h->uvlinesize = pic->f.linesize[1];
|
|
||||||
|
|
||||||
if (!h->qscale_table_pool) {
|
if (!h->qscale_table_pool) {
|
||||||
ret = init_table_pools(h);
|
ret = init_table_pools(h);
|
||||||
|
@ -266,18 +266,6 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
|
|||||||
{
|
{
|
||||||
int r, ret;
|
int r, ret;
|
||||||
|
|
||||||
if (s->avctx->hwaccel) {
|
|
||||||
assert(!pic->hwaccel_picture_private);
|
|
||||||
if (s->avctx->hwaccel->priv_data_size) {
|
|
||||||
pic->hwaccel_priv_buf = av_buffer_allocz(s->avctx->hwaccel->priv_data_size);
|
|
||||||
if (!pic->hwaccel_priv_buf) {
|
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pic->tf.f = &pic->f;
|
pic->tf.f = &pic->f;
|
||||||
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
|
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
|
||||||
s->codec_id != AV_CODEC_ID_VC1IMAGE &&
|
s->codec_id != AV_CODEC_ID_VC1IMAGE &&
|
||||||
@ -294,11 +282,21 @@ 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_buffer_unref(&pic->hwaccel_priv_buf);
|
|
||||||
pic->hwaccel_picture_private = NULL;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s->avctx->hwaccel) {
|
||||||
|
assert(!pic->hwaccel_picture_private);
|
||||||
|
if (s->avctx->hwaccel->priv_data_size) {
|
||||||
|
pic->hwaccel_priv_buf = av_buffer_allocz(s->avctx->hwaccel->priv_data_size);
|
||||||
|
if (!pic->hwaccel_priv_buf) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s->linesize && (s->linesize != pic->f.linesize[0] ||
|
if (s->linesize && (s->linesize != pic->f.linesize[0] ||
|
||||||
s->uvlinesize != pic->f.linesize[1])) {
|
s->uvlinesize != pic->f.linesize[1])) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user