[FFmpeg-devel] [PATCH] Add hwaccel_data infrastructure
Gwenole Beauchesne
gbeauchesne
Wed Mar 4 10:31:46 CET 2009
On Wed, 4 Mar 2009, Michael Niedermayer wrote:
>> Because I suggested open/close and you said only when needed. :) So I
>> assumed it was the wrong route since, currently, VA API only needs
>> av_mallocz() at frame buffer creation and do extra work at frame
>> buffer destruction.
>
> can you explain what this extra work is?
For VA API:
int ff_vaapi_destroy_picture(AVCodecContext *avctx, AVFrame *pic)
{
struct vaapi_render_state_private *rds = pic->hwaccel_data_private;
assert(rds);
if (rds->slice_data) {
if (!rds->mapped_slice_data)
av_free(rds->slice_data);
rds->slice_data = NULL;
}
if (rds->slice_params) {
if (!rds->mapped_slice_data)
av_free(rds->slice_params);
rds->slice_params = NULL;
}
av_free(rds);
return 0;
}
I could do that at ::end_frame() time, once they are committed, though.
However, for VDPAU, I am not sure there is another place than a ::close()
to destroy the bitstreamBuffers, unless they are copied locally in
vdp_decoder_render(). IIRC, this is asynchronous so if we delete them
straight away, some weird things could happen when the function comes to
actually need them later. ;-)
More information about the ffmpeg-devel
mailing list