summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2017-12-29 01:27:11 +0300
committerDmitry Osipenko <digetx@gmail.com>2017-12-29 01:34:15 +0300
commit1e168d3fb73cd7eff4f7871955f1f8facd7db486 (patch)
tree0f52eae010965103c26bec01bace8d2d8625c998
parent4741440150aa0f81f394b0a559c977cd5a795dd9 (diff)
Check if background surface is allocated
Fixes crashing VDPAU over VAAPI.
-rw-r--r--src/surface_mixer.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/surface_mixer.c b/src/surface_mixer.c
index b8aa5fc..46b24f9 100644
--- a/src/surface_mixer.c
+++ b/src/surface_mixer.c
@@ -536,10 +536,17 @@ VdpStatus vdp_video_mixer_render(
dst_vid_height < bg_height ||
dst_vid_width < bg_width);
- if (draw_background && !bg_surf) {
+ if (bg_surf) {
+ pthread_mutex_lock(&bg_surf->lock);
+ }
+
+ if (draw_background && (!bg_surf || !bg_surf->data_allocated)) {
if (background_source_rect) {
ret = dynamic_alloc_surface_data(dest_surf);
if (ret) {
+ if (bg_surf) {
+ pthread_mutex_unlock(&bg_surf->lock);
+ }
pthread_mutex_unlock(&dest_surf->lock);
pthread_mutex_unlock(&mix->lock);
put_mixer(mix);
@@ -565,9 +572,10 @@ VdpStatus vdp_video_mixer_render(
}
}
- if (draw_background && bg_surf) {
+ if (draw_background && (bg_surf && bg_surf->data_allocated)) {
ret = dynamic_alloc_surface_data(dest_surf);
if (ret) {
+ pthread_mutex_unlock(&bg_surf->lock);
pthread_mutex_unlock(&dest_surf->lock);
pthread_mutex_unlock(&mix->lock);
put_mixer(mix);
@@ -589,6 +597,10 @@ VdpStatus vdp_video_mixer_render(
dest_surf->height);
}
+ if (bg_surf) {
+ pthread_mutex_unlock(&bg_surf->lock);
+ }
+
if (!draw_background) {
if (!mix->custom_csc)
shared = create_shared_surface(dest_surf,