Commit 023fa8c4 authored by Ilkka Ollakka's avatar Ilkka Ollakka

transcode: rewrite fps/lipsync code

Add some comments on how the code should work. Basic idea is first
check input lipsync against audio track. Then check if we can drop the
picture based on output pts and then do same checked in OutputFrame as
some filters can output multiple pictures (yadif2x etc).

simple framerate conversion from 25 worked to 4,5,10,20,23,29.97,50.60.
Not sure if yadif2x and all work fully yet.
parent f4f66b0f
......@@ -204,7 +204,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
{
if( p_sys->b_master_sync )
{
mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1;
mtime_t i_pts = date_Get( &id->interpolated_pts );
mtime_t i_drift = 0;
if( likely( p_audio_buf->i_pts != VLC_TS_INVALID ) )
......@@ -217,7 +217,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
"audio drift is too high (%"PRId64"), resetting master sync",
i_drift );
date_Set( &id->interpolated_pts, p_audio_buf->i_pts );
i_pts = p_audio_buf->i_pts + 1;
i_pts = date_Get( &id->interpolated_pts );
}
if( likely(p_audio_buf->i_pts != VLC_TS_INVALID ) )
p_sys->i_master_drift = p_audio_buf->i_pts - i_pts;
......
......@@ -11,6 +11,7 @@
#include <vlc_picture_fifo.h>
/*100ms is around the limit where people are noticing lipsync issues*/
#define MASTER_SYNC_MAX_DRIFT 100000
struct sout_stream_sys_t
......@@ -99,7 +100,10 @@ struct sout_stream_id_t
encoder_t *p_encoder;
/* Sync */
date_t interpolated_pts;
date_t interpolated_pts; /**< Incoming calculated PTS */
date_t next_output_pts; /**< output calculated PTS */
int i_output_frame_interval;
int i_input_frame_interval;
};
/* OSD */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment