[vlc-commits] vdpau/chroma: remove dead code and simplify

Rémi Denis-Courmont git at videolan.org
Sat Jun 7 18:28:01 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  7 17:00:04 2014 +0300| [7f569759b4658f68575d5382a31eef5cff58ec4b] | committer: Rémi Denis-Courmont

vdpau/chroma: remove dead code and simplify

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7f569759b4658f68575d5382a31eef5cff58ec4b
---

 modules/hw/vdpau/chroma.c |   29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index 9474795..fa63676 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -292,24 +292,21 @@ static picture_t *OutputAllocate(filter_t *filter)
     picture_sys_t *psys = pic->p_sys;
     assert(psys->vdp != NULL);
 
-    if (unlikely(sys->vdp != psys->vdp) && (sys->mixer != VDP_INVALID_HANDLE))
-    {
-        Flush(filter); /* release surfaces from the old device */
-        vdp_video_mixer_destroy(sys->vdp, sys->mixer);
-        vdp_release_x11(sys->vdp);
-        sys->mixer = VDP_INVALID_HANDLE;
+    if (likely(sys->mixer != VDP_INVALID_HANDLE))
+    {   /* Not the first output picture */
+        assert(psys->vdp == sys->vdp);
+        return pic;
     }
 
-    if (unlikely(sys->mixer == VDP_INVALID_HANDLE))
-    {
-        sys->vdp = vdp_hold_x11(psys->vdp, NULL);
-        sys->device = psys->device;
-        sys->mixer = MixerCreate(filter);
-        if (sys->mixer == VDP_INVALID_HANDLE)
-            goto error;
-    }
-    return pic;
-error:
+    /* First picture: get the context and allocate the mixer */
+    sys->vdp = vdp_hold_x11(psys->vdp, NULL);
+    sys->device = psys->device;
+    sys->mixer = MixerCreate(filter);
+    if (sys->mixer != VDP_INVALID_HANDLE)
+        return pic;
+
+    vdp_release_x11(psys->vdp);
+    psys->vdp = NULL;
     picture_Release(pic);
     return NULL;
 }



More information about the vlc-commits mailing list