--- ext/jpeg/gstjpegdec.c	Tue Nov 30 13:25:44 2010
+++ ext/jpeg/gstjpegdec.c	Tue Nov 30 13:28:40 2010
@@ -445,6 +445,13 @@
       dec->parse_resync = FALSE;
       dec->parse_offset = 0;
       return (offset + 4);
+    } else if (value == 0xd8) {
+      /* Skip this frame if we found another SOI marker */
+      GST_DEBUG ("0x%08x: SOI marker before EOI, skipping", offset);
+      gst_adapter_flush(adapter, offset);
+      dec->parse_resync = FALSE;
+      dec->parse_offset = 0;
+      return 0;
     }
 
     if (value >= 0xd0 && value <= 0xd7)
