| 51 | |
| 52 | |
| 53 | static int get_frame_buffer(void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb) |
| 54 | { |
| 55 | VPxContext *ctx = priv; |
| 56 | AVBufferRef *buf; |
| 57 | |
| 58 | if (min_size > ctx->pool_size) { |
| 59 | av_buffer_pool_uninit(&ctx->pool); |
| 60 | /* According to the libvpx docs the buffer must be zeroed out. */ |
| 61 | ctx->pool = av_buffer_pool_init(min_size, av_buffer_allocz); |
| 62 | if (!ctx->pool) { |
| 63 | ctx->pool_size = 0; |
| 64 | return AVERROR(ENOMEM); |
| 65 | } |
| 66 | ctx->pool_size = min_size; |
| 67 | } |
| 68 | |
| 69 | buf = av_buffer_pool_get(ctx->pool); |
| 70 | if (!buf) |
| 71 | return AVERROR(ENOMEM); |
| 72 | |
| 73 | fb->priv = buf; |
| 74 | fb->size = ctx->pool_size; |
| 75 | fb->data = buf->data; |
| 76 | |
| 77 | return 0; |
| 78 | } |
| 79 | |
| 80 | static int release_frame_buffer(void *priv, vpx_codec_frame_buffer_t *fb) |
| 81 | { |
nothing calls this directly
no test coverage detected