[vlc-commits] demux: ts: check probe return count

Francois Cartegnie git at videolan.org
Tue Oct 13 20:14:50 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 12 17:42:11 2020 +0200| [40934eb32088fcc037593823e9fce37371aee6ec] | committer: Francois Cartegnie

demux: ts: check probe return count

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40934eb32088fcc037593823e9fce37371aee6ec
---

 modules/demux/mpeg/ts.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 62569d859f..b529c75984 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -2157,10 +2157,12 @@ int ProbeStart( demux_t *p_demux, int i_program )
         if( vlc_stream_Seek( p_sys->stream, i_pos ) )
             return VLC_EGENERIC;
 
-        ProbeChunk( p_demux, i_program, false, &b_found );
+        int i_count =  ProbeChunk( p_demux, i_program, false, &b_found );
+        if( i_count < PROBE_CHUNK_COUNT )
+            break;
 
         /* Go ahead one more chunk if end of file contained only stuffing packets */
-        i_probe_count += PROBE_CHUNK_COUNT;
+        i_probe_count += i_count;
     } while( i_pos < i_stream_size && !b_found &&
              i_probe_count < PROBE_MAX );
 
@@ -2188,10 +2190,12 @@ int ProbeEnd( demux_t *p_demux, int i_program )
         if( vlc_stream_Seek( p_sys->stream, i_pos ) )
             return VLC_EGENERIC;
 
-        ProbeChunk( p_demux, i_program, true, &b_found );
+        int i_count = ProbeChunk( p_demux, i_program, true, &b_found );
+        if( i_count < PROBE_CHUNK_COUNT )
+            break;
 
         /* Go ahead one more chunk if end of file contained only stuffing packets */
-        i_probe_count += PROBE_CHUNK_COUNT;
+        i_probe_count += i_count;
     } while( i_pos > 0 && !b_found &&
              i_probe_count < PROBE_MAX );
 



More information about the vlc-commits mailing list