Index: libs/libmythtv/util-vdpau.cpp
===================================================================
--- libs/libmythtv/util-vdpau.cpp	(revision 22967)
+++ libs/libmythtv/util-vdpau.cpp	(working copy)
@@ -86,7 +86,8 @@
     pipOutputSurface(0),    pipAlpha(0),       pipBorder(0),
     pipClear(0),            pipReady(0),       pipNeedsClear(false),
     vdp_flip_target(0),     vdp_flip_queue(0), vdpauDecode(false),
-    vdp_device(0),          errorCount(0),     errorState(kError_None),
+    vdp_device(0),          decoderDescription(0),
+    errorCount(0),          errorState(kError_None),
     vdp_get_proc_address(NULL),       vdp_device_destroy(NULL),
     vdp_get_error_string(NULL),       vdp_get_api_version(NULL),
     vdp_get_information_string(NULL), vdp_video_surface_create(NULL),
@@ -161,14 +162,18 @@
     return ok;
 }
 
-void VDPAUContext::Deinit(void)
+void VDPAUContext::DestroyDecoder(void)
 {
     if (decoder)
-    {
         vdp_decoder_destroy(decoder);
-        decoder = NULL;
-        pix_fmt = -1;
-    }
+    decoder = NULL;
+    pix_fmt = -1;
+    decoderDescription = 0;
+}
+
+void VDPAUContext::Deinit(void)
+{
+    DestroyDecoder();
     ClearReferenceFrames();
     DeinitOSD();
     FreeOutput();
@@ -910,6 +915,10 @@
     checkOutputSurfaces = false;
 }
 
+#define HASH_H264(arg) \
+  ((uint64_t)arg.num_ref_frames << 56) + \
+  ((uint64_t)arg.mb_adaptive_frame_field_flag << 48)
+
 void VDPAUContext::Decode(VideoFrame *frame)
 {
     if (!vdpauDecode)
@@ -932,6 +941,20 @@
         return;
     }
 
+    if (decoder && frame->pix_fmt == PIX_FMT_VDPAU_H264)
+    {
+        if (HASH_H264(render->info.h264) != decoderDescription)
+        {
+            VERBOSE(VB_IMPORTANT, LOC +
+                QString("h264 stream type has changed. Re-creating decoder."));
+            VERBOSE(VB_PLAYBACK, LOC + QString("Old desc '%1'")
+                .arg(HASH_H264(decoderDescription), 16, 16, QChar(48)));
+            VERBOSE(VB_PLAYBACK, LOC + QString("New desc '%1'")
+                .arg(HASH_H264(render->info.h264), 16, 16, QChar(48)));
+            DestroyDecoder();
+        }
+    }
+
     if (frame->pix_fmt != pix_fmt)
     {
         if (decoder)
@@ -944,6 +967,7 @@
 
         if (frame->pix_fmt == PIX_FMT_VDPAU_H264)
         {
+            decoderDescription = HASH_H264(render->info.h264);
             maxReferences = render->info.h264.num_ref_frames;
             if (maxReferences < 1 || maxReferences > 16)
             {
Index: libs/libmythtv/util-vdpau.h
===================================================================
--- libs/libmythtv/util-vdpau.h	(revision 22967)
+++ libs/libmythtv/util-vdpau.h	(working copy)
@@ -52,6 +52,7 @@
               QSize screen_size, bool color_control,
               int color_key, MythCodecID mcodecid,
               QString options);
+    void DestroyDecoder(void);
     void Deinit(void);
     VideoErrorState GetError(void) { return errorState; }
     bool IsErrored(void)
@@ -190,6 +191,7 @@
 
     bool              vdpauDecode;
     VdpDevice         vdp_device;
+    uint64_t          decoderDescription;
 
     int               errorCount;
     VideoErrorState   errorState;

