Index: libs/libmythtv/mpeg/pespacket.h
===================================================================
--- libs/libmythtv/mpeg/pespacket.h	(revision 9263)
+++ libs/libmythtv/mpeg/pespacket.h	(working copy)
@@ -59,7 +59,9 @@
           _pesdataSize(0), _allocSize(0)
     {
         _badPacket = !VerifyCRC();
-        _pesdataSize = max(Length()-1 + (HasCRC() ? 4 : 0), (uint)0);
+        _pesdataSize = Length() + (HasCRC() ? 4 : 0);
+	if (_pesdataSize > 0)
+            _pesdataSize -= 1;
     }
 
   private:
@@ -211,7 +213,8 @@
 
     uint CRC() const 
     {
-        uint offset = Length() - 1;
+        uint offset = Length();
+	if (offset > 0) offset -= 1;
         return ((_pesdata[offset+0]<<24) |
                 (_pesdata[offset+1]<<16) |
                 (_pesdata[offset+2]<<8) |
@@ -219,11 +222,15 @@
     }
 
     uint CalcCRC() const
-        { return mpegts_crc32(_pesdata, Length()-1); }
+    {
+        uint offset = Length();
+	if (offset > 0) offset -= 1;
+	return mpegts_crc32(_pesdata, offset); }
 
     void SetCRC(uint crc)
     {
-        uint offset = Length() - 1;
+        uint offset = Length();
+	if (offset > 0) offset -= 1;
         _pesdata[offset+0] = (crc & 0xff000000) >> 24;
         _pesdata[offset+1] = (crc & 0x00ff0000) >> 16;
         _pesdata[offset+2] = (crc & 0x0000ff00) >> 8;
