[vlc-commits] sout: record: truncate to highest buffer head if no iframe
Francois Cartegnie
git at videolan.org
Sat Apr 2 22:32:19 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Apr 2 16:34:48 2016 +0200| [1126f194421db5ea5f022a08df07c285964f25b4] | committer: Francois Cartegnie
sout: record: truncate to highest buffer head if no iframe
Avoids having audio or video less parts on start
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1126f194421db5ea5f022a08df07c285964f25b4
---
modules/stream_out/record.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
index 46b5f80..3b7604a 100644
--- a/modules/stream_out/record.c
+++ b/modules/stream_out/record.c
@@ -503,16 +503,24 @@ static void OutputStart( sout_stream_t *p_stream )
/* Compute highest timestamp of first I over all streams */
p_sys->i_dts_start = 0;
+ mtime_t i_highest_head_dts = 0;
for( int i = 0; i < p_sys->i_id; i++ )
{
sout_stream_id_sys_t *id = p_sys->id[i];
- block_t *p_block;
if( !id->id || !id->p_first )
continue;
- mtime_t i_dts = id->p_first->i_dts;
- for( p_block = id->p_first; p_block != NULL; p_block = p_block->p_next )
+ const block_t *p_block = id->p_first;
+ mtime_t i_dts = p_block->i_dts;
+
+ if( i_dts > i_highest_head_dts &&
+ ( id->fmt.i_cat == AUDIO_ES || id->fmt.i_cat == VIDEO_ES ) )
+ {
+ i_highest_head_dts = i_dts;
+ }
+
+ for( ; p_block != NULL; p_block = p_block->p_next )
{
if( p_block->i_flags & BLOCK_FLAG_TYPE_I )
{
@@ -525,6 +533,9 @@ static void OutputStart( sout_stream_t *p_stream )
p_sys->i_dts_start = i_dts;
}
+ if( p_sys->i_dts_start == 0 )
+ p_sys->i_dts_start = i_highest_head_dts;
+
sout_stream_id_sys_t *p_cand;
do
{
More information about the vlc-commits
mailing list