summaryrefslogtreecommitdiffstats
path: root/video/mp_image_pool.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-08 16:16:55 +0200
committerwm4 <wm4@nowhere>2017-08-08 16:16:55 +0200
commit7f9193b35325f16e0a3fc290fb0723de40b704c5 (patch)
tree129d75b907e1f9a8e8e6ca651f1ecc8a73465375 /video/mp_image_pool.c
parentf7fb6e186ad7f9ed22ccb016a5a0bfe52c2ebe0f (diff)
downloadmpv-7f9193b35325f16e0a3fc290fb0723de40b704c5.tar.bz2
mpv-7f9193b35325f16e0a3fc290fb0723de40b704c5.tar.xz
Revert "mp_image_pool: disallow adding read only frames"
This reverts commit 0ce3dce03aaea3e777ebf68504d5afb3f5e3f9e1. We actually explicitly add read-only frames in some of the hwaccel code via mp_image_new_custom_ref(), which sets AV_BUFFER_FLAG_READONLY. It's probably better to keep it this way. Fixes #4652 (and some related issues with D3D).
Diffstat (limited to 'video/mp_image_pool.c')
-rw-r--r--video/mp_image_pool.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/video/mp_image_pool.c b/video/mp_image_pool.c
index 547e626468..9a848af925 100644
--- a/video/mp_image_pool.c
+++ b/video/mp_image_pool.c
@@ -152,9 +152,9 @@ struct mp_image *mp_image_pool_get_no_alloc(struct mp_image_pool *pool, int fmt,
// This assumes the buffer is at this point exclusively owned by us: we
// can't track whether the buffer is unique otherwise.
// (av_buffer_is_writable() checks the refcount of the new buffer only.)
- assert(av_buffer_is_writable(new->bufs[0]));
+ int flags = av_buffer_is_writable(new->bufs[0]) ? 0 : AV_BUFFER_FLAG_READONLY;
ref->bufs[0] = av_buffer_create(new->bufs[0]->data, new->bufs[0]->size,
- unref_image, new, 0);
+ unref_image, new, flags);
if (!ref->bufs[0]) {
talloc_free(ref);
return NULL;
@@ -169,10 +169,6 @@ struct mp_image *mp_image_pool_get_no_alloc(struct mp_image_pool *pool, int fmt,
void mp_image_pool_add(struct mp_image_pool *pool, struct mp_image *new)
{
- assert(new->bufs[0]);
- assert(!new->bufs[1]);
- assert(mp_image_is_writeable(new));
-
struct image_flags *it = talloc_ptrtype(new, it);
*it = (struct image_flags) { .pool_alive = true };
new->priv = it;