* It is 60s max, remember as it is limited by the size it takes by es_out.c
* it can be really large.
*/
-#define CR_BUFFERING_TARGET (60000000)
+//#define CR_BUFFERING_TARGET (60000000)
+/* Due to some problems in es_out, we cannot use a large value yet */
+#define CR_BUFFERING_TARGET (100000)
/*****************************************************************************
* Structures
/* */
vlc_mutex_t lock;
- /* Reference point */
- bool b_has_reference;
- clock_point_t ref;
-
/* Last point
* It is used to detect unexpected stream discontinuities */
clock_point_t last;
unsigned i_index;
} late;
+ /* Reference point */
+ clock_point_t ref;
+ bool b_has_reference;
+
+ /* External clock drift */
+ mtime_t i_external_clock;
+ bool b_has_external_clock;
+
/* Current modifiers */
+ bool b_paused;
int i_rate;
mtime_t i_pts_delay;
- bool b_paused;
mtime_t i_pause_date;
};
vlc_mutex_init( &cl->lock );
cl->b_has_reference = false;
cl->ref = clock_point_Create( VLC_TS_INVALID, VLC_TS_INVALID );
+ cl->b_has_external_clock = false;
cl->last = clock_point_Create( VLC_TS_INVALID, VLC_TS_INVALID );
cl->b_has_reference = true;
cl->ref = clock_point_Create( i_ck_stream,
__MAX( cl->i_ts_max + CR_MEAN_PTS_GAP, i_ck_system ) );
+ cl->b_has_external_clock = false;
}
/* Compute the drift between the stream clock and the system clock
cl->b_has_reference = false;
cl->ref = clock_point_Create( VLC_TS_INVALID, VLC_TS_INVALID );
+ cl->b_has_external_clock = false;
cl->i_ts_max = VLC_TS_INVALID;
vlc_mutex_unlock( &cl->lock );
return VLC_SUCCESS;
}
-void input_clock_ChangeSystemOrigin( input_clock_t *cl, mtime_t i_system )
+void input_clock_ChangeSystemOrigin( input_clock_t *cl, bool b_absolute, mtime_t i_system )
{
vlc_mutex_lock( &cl->lock );
assert( cl->b_has_reference );
- const mtime_t i_offset = i_system - cl->ref.i_system - ClockGetTsOffset( cl );
+ mtime_t i_offset;
+ if( b_absolute )
+ {
+ i_offset = i_system - cl->ref.i_system - ClockGetTsOffset( cl );
+ }
+ else
+ {
+ if( !cl->b_has_external_clock )
+ {
+ cl->b_has_external_clock = true;
+ cl->i_external_clock = i_system;
+ }
+ i_offset = i_system - cl->i_external_clock;
+ }
cl->ref.i_system += i_offset;
cl->last.i_system += i_offset;
vlc_mutex_unlock( &cl->lock );
}
+void input_clock_GetSystemOrigin( input_clock_t *cl, mtime_t *pi_system, mtime_t *pi_delay )
+{
+ vlc_mutex_lock( &cl->lock );
+
+ assert( cl->b_has_reference );
+
+ *pi_system = cl->ref.i_system;
+ if( pi_delay )
+ *pi_delay = cl->i_pts_delay;
+
+ vlc_mutex_unlock( &cl->lock );
+}
+
#warning "input_clock_SetJitter needs more work"
void input_clock_SetJitter( input_clock_t *cl,
mtime_t i_pts_delay, int i_cr_average )