From bb652ac24509b3054f8272eed399f39448b6184b Mon Sep 17 00:00:00 2001
From: Christophe Massiot <massiot@videolan.org>
Date: Tue, 17 Apr 2001 14:54:54 +0000
Subject: [PATCH] Fixed optional PES size bug, courtesy of Steve Brown
 <sbrown@cortland.com>.

---
 src/input/mpeg_system.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/input/mpeg_system.c b/src/input/mpeg_system.c
index 132a34f4d9..118158ee35 100644
--- a/src/input/mpeg_system.c
+++ b/src/input/mpeg_system.c
@@ -2,7 +2,7 @@
  * mpeg_system.c: TS, PS and PES management
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: mpeg_system.c,v 1.50 2001/04/13 01:49:22 henri Exp $
+ * $Id: mpeg_system.c,v 1.51 2001/04/17 14:54:54 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -148,7 +148,9 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
     }
 
     /* Get the PES size if defined */
-    p_es->i_pes_real_size = U16_AT(p_header + 4) + 6;
+    p_es->i_pes_real_size = U16_AT(p_header + 4);
+    if( p_es->i_pes_real_size )
+        p_es->i_pes_real_size += 6;
 
     /* First read the 6 header bytes common to all PES packets:
      * use them to test the PES validity */
-- 
2.25.4