| 388 | } |
| 389 | |
| 390 | AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) |
| 391 | { |
| 392 | AVBufferRef *ret; |
| 393 | BufferPoolEntry *buf; |
| 394 | |
| 395 | ff_mutex_lock(&pool->mutex); |
| 396 | buf = pool->pool; |
| 397 | if (buf) { |
| 398 | memset(&buf->buffer, 0, sizeof(buf->buffer)); |
| 399 | ret = buffer_create(&buf->buffer, buf->data, pool->size, |
| 400 | pool_release_buffer, buf, 0); |
| 401 | if (ret) { |
| 402 | pool->pool = buf->next; |
| 403 | buf->next = NULL; |
| 404 | buf->buffer.flags_internal |= BUFFER_FLAG_NO_FREE; |
| 405 | } |
| 406 | } else { |
| 407 | ret = pool_alloc_buffer(pool); |
| 408 | } |
| 409 | ff_mutex_unlock(&pool->mutex); |
| 410 | |
| 411 | if (ret) |
| 412 | atomic_fetch_add_explicit(&pool->refcount, 1, memory_order_relaxed); |
| 413 | |
| 414 | return ret; |
| 415 | } |
| 416 | |
| 417 | void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref) |
| 418 | { |
no test coverage detected