vdpau/chroma: fix corner case of corner case when changing device

To ensure the vdp_t instance pointers comparison is valid, the old and
new instances must be contemporary. Otherwise, the heap could put both
instances at the same memory address. So keep a reference to the old
device until after the comparison.
vdpau/chroma: fix double free on error
vdpau/chroma: keep history even if output picture allocation fails