int state_encoder_waitok;     /* Encoder pre-wait done */
        int state_encoder_runok;      /* Encoder has run for >= .25 sec */
        int state_decoder_run;        /* Decoder is running */
+       int state_decoder_ready;      /* Decoder is stabilized & streamable */
        int state_usbstream_run;      /* FX2 is streaming */
-       int state_decoder_quiescent;  /* Decoder idle for > 50msec */
+       int state_decoder_quiescent;  /* Decoder idle for minimal interval */
        int state_pipeline_config;    /* Pipeline is configured */
        int state_pipeline_req;       /* Somebody wants to stream */
        int state_pipeline_pause;     /* Pipeline must be paused */
        void (*state_func)(void *);
        void *state_data;
 
-       /* Timer for measuring decoder settling time */
+       /* Timer for measuring required decoder settling time before we're
+          allowed to fire it up again. */
        struct timer_list quiescent_timer;
 
+       /* Timer for measuring decoder stabilization time, which is the
+          amount of time we need to let the decoder run before we can
+          trust its output (otherwise the encoder might see garbage and
+          then fail to start correctly). */
+       struct timer_list decoder_stabilization_timer;
+
        /* Timer for measuring encoder pre-wait time */
        struct timer_list encoder_wait_timer;
 
 
    before we are allowed to start it running. */
 #define TIME_MSEC_DECODER_WAIT 50
 
+/* This defines a minimum interval that the decoder must be allowed to run
+   before we can safely begin using its streaming output. */
+#define TIME_MSEC_DECODER_STABILIZATION_WAIT 300
+
 /* This defines a minimum interval that the encoder must remain quiet
    before we are allowed to configure it.  I had this originally set to
    50msec, but Martin Dauskardt <martin.dauskardt@gmx.de> reports that
 static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
 static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
 static void pvr2_hdw_quiescent_timeout(unsigned long);
+static void pvr2_hdw_decoder_stabilization_timeout(unsigned long);
 static void pvr2_hdw_encoder_wait_timeout(unsigned long);
 static void pvr2_hdw_encoder_run_timeout(unsigned long);
 static int pvr2_issue_simple_cmd(struct pvr2_hdw *,u32);
        hdw->quiescent_timer.data = (unsigned long)hdw;
        hdw->quiescent_timer.function = pvr2_hdw_quiescent_timeout;
 
+       init_timer(&hdw->decoder_stabilization_timer);
+       hdw->decoder_stabilization_timer.data = (unsigned long)hdw;
+       hdw->decoder_stabilization_timer.function =
+               pvr2_hdw_decoder_stabilization_timeout;
+
        init_timer(&hdw->encoder_wait_timer);
        hdw->encoder_wait_timer.data = (unsigned long)hdw;
        hdw->encoder_wait_timer.function = pvr2_hdw_encoder_wait_timeout;
  fail:
        if (hdw) {
                del_timer_sync(&hdw->quiescent_timer);
+               del_timer_sync(&hdw->decoder_stabilization_timer);
                del_timer_sync(&hdw->encoder_run_timer);
                del_timer_sync(&hdw->encoder_wait_timer);
                if (hdw->workqueue) {
                hdw->workqueue = NULL;
        }
        del_timer_sync(&hdw->quiescent_timer);
+       del_timer_sync(&hdw->decoder_stabilization_timer);
        del_timer_sync(&hdw->encoder_run_timer);
        del_timer_sync(&hdw->encoder_wait_timer);
        if (hdw->fw_buffer) {
 
        switch (hdw->pathway_state) {
        case PVR2_PATHWAY_ANALOG:
-               if (hdw->state_decoder_run) {
+               if (hdw->state_decoder_run && hdw->state_decoder_ready) {
                        /* In analog mode, if the decoder is running, then
                           run the encoder. */
                        return !0;
 }
 
 
+/* Timeout function for decoder stabilization timer. */
+static void pvr2_hdw_decoder_stabilization_timeout(unsigned long data)
+{
+       struct pvr2_hdw *hdw = (struct pvr2_hdw *)data;
+       hdw->state_decoder_ready = !0;
+       trace_stbit("state_decoder_ready", hdw->state_decoder_ready);
+       hdw->state_stale = !0;
+       queue_work(hdw->workqueue, &hdw->workpoll);
+}
+
+
 /* Timeout function for encoder wait timer. */
 static void pvr2_hdw_encoder_wait_timeout(unsigned long data)
 {
                }
                hdw->state_decoder_quiescent = 0;
                hdw->state_decoder_run = 0;
-               /* paranoia - solve race if timer just completed */
+               /* paranoia - solve race if timer(s) just completed */
                del_timer_sync(&hdw->quiescent_timer);
+               /* Kill the stabilization timer, in case we're killing the
+                  encoder before the previous stabilization interval has
+                  been properly timed. */
+               del_timer_sync(&hdw->decoder_stabilization_timer);
+               hdw->state_decoder_ready = 0;
        } else {
                if (!hdw->state_decoder_quiescent) {
                        if (!timer_pending(&hdw->quiescent_timer)) {
                if (hdw->flag_decoder_missed) return 0;
                if (pvr2_decoder_enable(hdw,!0) < 0) return 0;
                hdw->state_decoder_quiescent = 0;
+               hdw->state_decoder_ready = 0;
                hdw->state_decoder_run = !0;
+               hdw->decoder_stabilization_timer.expires =
+                       jiffies +
+                       (HZ * TIME_MSEC_DECODER_STABILIZATION_WAIT / 1000);
+               add_timer(&hdw->decoder_stabilization_timer);
        }
        trace_stbit("state_decoder_quiescent",hdw->state_decoder_quiescent);
        trace_stbit("state_decoder_run",hdw->state_decoder_run);
+       trace_stbit("state_decoder_ready", hdw->state_decoder_ready);
        return !0;
 }
 
                        buf,acnt,
                        "worker:%s%s%s%s%s%s%s",
                        (hdw->state_decoder_run ?
-                        " <decode:run>" :
+                        (hdw->state_decoder_ready ?
+                         "<decode:run>" : " <decode:start>") :
                         (hdw->state_decoder_quiescent ?
                          "" : " <decode:stop>")),
                        (hdw->state_decoder_quiescent ?