Ticket #1334: vlc_transcode_drift_fps.diff
| File vlc_transcode_drift_fps.diff, 3.1 kB (added by ileoo, 11 months ago) |
|---|
-
transcode.c
old new 440 440 /* Sync */ 441 441 vlc_bool_t b_master_sync; 442 442 mtime_t i_master_drift; 443 long i_master_sync_drift; 443 444 }; 444 445 445 446 struct decoder_owner_sys_t … … 1559 1560 if( p_sys->b_master_sync ) 1560 1561 { 1561 1562 mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1; 1562 if ( p_audio_buf->start_date - i_dts > MASTER_SYNC_MAX_DRIFT1563 || p_audio_buf->start_date - i_dts < - MASTER_SYNC_MAX_DRIFT)1563 if ( p_audio_buf->start_date - i_dts > p_sys->i_master_sync_drift 1564 || p_audio_buf->start_date - i_dts < -p_sys->i_master_sync_drift) 1564 1565 { 1565 1566 msg_Dbg( p_stream, "drift is too high, resetting master sync" ); 1566 1567 date_Set( &id->interpolated_pts, p_audio_buf->start_date ); … … 2016 2017 id->p_encoder->fmt_out.video.i_frame_rate_base = 1; 2017 2018 } 2018 2019 } 2020 p_sys->i_master_sync_drift=(MASTER_SYNC_MAX_DRIFT*id->p_decoder->fmt_out.video.i_frame_rate)/(p_sys->f_fps*id->p_decoder->fmt_out.video.i_frame_rate_base); 2021 msg_Dbg( p_stream, "master sync %d", p_sys->i_master_sync_drift); 2019 2022 2023 2020 2024 id->p_encoder->fmt_in.video.i_frame_rate = 2021 2025 id->p_encoder->fmt_out.video.i_frame_rate; 2022 2026 id->p_encoder->fmt_in.video.i_frame_rate_base = … … 2172 2176 mtime_t i_pts; 2173 2177 2174 2178 i_pts = date_Get( &id->interpolated_pts ) + 1; 2175 if ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT2176 || p_pic->date - i_pts < - MASTER_SYNC_MAX_DRIFT)2179 if ( p_pic->date - i_pts > p_sys->i_master_sync_drift 2180 || p_pic->date - i_pts < -p_sys->i_master_sync_drift ) 2177 2181 { 2178 2182 msg_Dbg( p_stream, "drift is too high, resetting master sync" ); 2179 2183 date_Set( &id->interpolated_pts, p_pic->date ); … … 2420 2424 if( p_sys->b_master_sync ) 2421 2425 { 2422 2426 mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1; 2423 if ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT2424 || p_pic->date - i_pts < - MASTER_SYNC_MAX_DRIFT)2427 if ( p_pic->date - i_pts > p_sys->i_master_sync_drift 2428 || p_pic->date - i_pts < -p_sys->i_master_sync_drift ) 2425 2429 { 2426 2430 msg_Dbg( p_stream, "drift is too high, resetting master sync" ); 2427 2431 date_Set( &id->interpolated_pts, p_pic->date ); … … 2433 2437 if( p_sys->b_master_sync && i_duplicate > 1 ) 2434 2438 { 2435 2439 mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1; 2436 if( (p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT)2437 || ((p_pic->date - i_pts) < - MASTER_SYNC_MAX_DRIFT) )2440 if( (p_pic->date - i_pts > p_sys->i_master_sync_drift) 2441 || ((p_pic->date - i_pts) < -p_sys->i_master_sync_drift) ) 2438 2442 { 2439 2443 msg_Dbg( p_stream, "drift is too high, resetting master sync" ); 2440 2444 date_Set( &id->interpolated_pts, p_pic->date );
