[vlc-commits] display: copy picture into pool if necessary
Rémi Denis-Courmont
git at videolan.org
Wed Dec 26 20:56:06 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Dec 26 17:02:55 2018 +0200| [0ba24913fa88f2569188a4452041052cb8fd0430] | committer: Rémi Denis-Courmont
display: copy picture into pool if necessary
If the display supports the source format, the converter chain will be
empty, and the "conversion" will be a no-op. Yet, the picture might not
be allocated from the display pool, e.g. because the pool is slow or too
small compared to the DPB size.
Some filters will also do this when they modify the pictures in place.
However conversion filters should not be able to do that.
Copy the picture manually when this corner case happens.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ba24913fa88f2569188a4452041052cb8fd0430
---
src/video_output/display.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 1da4b8356f..1438164e8c 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -711,7 +711,25 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
return NULL;
}
- return filter_chain_VideoFilter(osys->converters, picture);
+ picture = filter_chain_VideoFilter(osys->converters, picture);
+
+ if (picture != NULL && vd->pool != NULL) {
+ picture_pool_t *pool = vd->pool(vd, 3);
+
+ if (!picture_pool_OwnsPic(pool, picture)) {
+ /* The picture is not be allocated from the expected pool. Copy. */
+ picture_t *direct = picture_pool_Get(pool);
+
+ if (direct != NULL) {
+ video_format_CopyCropAr(&direct->format, &picture->format);
+ picture_Copy(direct, picture);
+ }
+ picture_Release(picture);
+ picture = direct;
+ }
+ }
+
+ return picture;
}
void vout_FilterFlush(vout_display_t *vd)
More information about the vlc-commits
mailing list