@ -88,6 +88,8 @@ typedef struct Demuxer {
// name used for logging
// name used for logging
char log_name [ 32 ] ;
char log_name [ 32 ] ;
int64_t wallclock_start ;
/* number of times input stream should be looped */
/* number of times input stream should be looped */
int loop ;
int loop ;
/* actual duration of the longest stream in a file at the moment when
/* actual duration of the longest stream in a file at the moment when
@ -517,7 +519,7 @@ static void readrate_sleep(Demuxer *d)
int64_t stream_ts_offset , pts , now ;
int64_t stream_ts_offset , pts , now ;
stream_ts_offset = FFMAX ( ds - > first_dts ! = AV_NOPTS_VALUE ? ds - > first_dts : 0 , file_start ) ;
stream_ts_offset = FFMAX ( ds - > first_dts ! = AV_NOPTS_VALUE ? ds - > first_dts : 0 , file_start ) ;
pts = av_rescale ( ds - > dts , 1000000 , AV_TIME_BASE ) ;
pts = av_rescale ( ds - > dts , 1000000 , AV_TIME_BASE ) ;
now = ( av_gettime_relative ( ) - ist - > start ) * f - > readrate + stream_ts_offset ;
now = ( av_gettime_relative ( ) - d - > wallclock_ start) * f - > readrate + stream_ts_offset ;
if ( pts - burst_until > now )
if ( pts - burst_until > now )
av_usleep ( pts - burst_until - now ) ;
av_usleep ( pts - burst_until - now ) ;
}
}
@ -546,6 +548,8 @@ static void *input_thread(void *arg)
thread_set_name ( f ) ;
thread_set_name ( f ) ;
d - > wallclock_start = av_gettime_relative ( ) ;
while ( 1 ) {
while ( 1 ) {
DemuxMsg msg = { NULL } ;
DemuxMsg msg = { NULL } ;