[vlc-devel] commit: Fix demuxdump to work with RTP input, which would dump garbage when RTP ( Marian Ďurkovič )

git version control git at videolan.org
Fri Sep 4 12:12:38 CEST 2009


vlc | branch: master | Marian Ďurkovič <md at bts.sk> | Fri Sep  4 11:36:47 2009 +0200| [8f9391f621f409375238c9967f3e264ebba38637] | committer: JP Dinger 

Fix demuxdump to work with RTP input, which would dump garbage when RTP
input is used. When stream_Read was used alone, it read 1316 bytes from
the RTP input add added garbage upto DUMP_BLOCKSIZE. With stream_Peek it
works as expected and also makes the whole demuxdump faster.

Signed-off-by: JP Dinger <jpd at videolan.org>

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

 modules/demux/demuxdump.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/demux/demuxdump.c b/modules/demux/demuxdump.c
index 3404577..0a97bf4 100644
--- a/modules/demux/demuxdump.c
+++ b/modules/demux/demuxdump.c
@@ -77,8 +77,6 @@ struct demux_sys_t
     char        *psz_file;
     FILE        *p_file;
     uint64_t    i_write;
-
-    uint8_t     buffer[DUMP_BLOCKSIZE];
 };
 
 /*
@@ -173,14 +171,14 @@ static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
+    const uint8_t *p_peek;
     int i_data;
 
-    /* I'm pretty sure that stream_Peek,stream_Read( , NULL ) would be faster*/
-    i_data = stream_Read( p_demux->s, p_sys->buffer, DUMP_BLOCKSIZE );
+    i_data = stream_Peek( p_demux->s, &p_peek, DUMP_BLOCKSIZE );
     if ( i_data <= 0 )
         return i_data;
 
-    i_data = fwrite( p_sys->buffer, 1, i_data, p_sys->p_file );
+    i_data = fwrite( p_peek, 1, i_data, p_sys->p_file );
 
     if( i_data == 0 )
     {
@@ -191,6 +189,7 @@ static int Demux( demux_t *p_demux )
     msg_Dbg( p_demux, "dumped %d bytes", i_data );
 #endif
 
+    stream_Read( p_demux->s, NULL, i_data );
     p_sys->i_write += i_data;
 
     return 1;




More information about the vlc-devel mailing list