vout: make vout_FilterDisplay() work always
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 26 Jul 2017 18:54:56 +0000 (21:54 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 26 Jul 2017 18:54:56 +0000 (21:54 +0300)
Deal with the trivial case whereby the vout is unfiltered. Simplify the
call sites accordingly.

src/video_output/display.c
src/video_output/video_output.c

index 055bb7d..fe2c86e 100644 (file)
@@ -1092,11 +1092,14 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
-    assert(osys->filters);
+    if (osys->filters == NULL)
+        return picture;
+
     if (filter_chain_IsEmpty(osys->filters)) {
         picture_Release(picture);
         return NULL;
     }
+
     return filter_chain_VideoFilter(osys->filters, picture);
 }
 
@@ -1451,8 +1454,7 @@ static void SplitterPrepare(vout_display_t *vd,
     }
 
     for (int i = 0; i < sys->count; i++) {
-        if (vout_IsDisplayFiltered(sys->display[i]))
-            sys->picture[i] = vout_FilterDisplay(sys->display[i], sys->picture[i]);
+        sys->picture[i] = vout_FilterDisplay(sys->display[i], sys->picture[i]);
         if (sys->picture[i])
             vout_display_Prepare(sys->display[i], sys->picture[i], NULL);
     }
index 336b97e..640232a 100644 (file)
@@ -1045,17 +1045,17 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
 
     /* Render the direct buffer */
     vout_UpdateDisplaySourceProperties(vd, &todisplay->format);
+
+    todisplay = vout_FilterDisplay(vd, todisplay);
+    if (todisplay == NULL) {
+        if (subpic != NULL)
+            subpicture_Delete(subpic);
+        return VLC_EGENERIC;
+    }
+
     if (sys->display.use_dr) {
         vout_display_Prepare(vd, todisplay, subpic);
     } else {
-        todisplay = vout_FilterDisplay(vd, todisplay);
-        if (todisplay == NULL)
-        {
-            if (subpic != NULL)
-                subpicture_Delete(subpic);
-            return VLC_EGENERIC;
-        }
-
         if (!do_dr_spu && !do_early_spu && vout->p->spu_blend && subpic)
             picture_BlendSubpicture(todisplay, vout->p->spu_blend, subpic);
         vout_display_Prepare(vd, todisplay, do_dr_spu ? subpic : NULL);