mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 23:45:35 +00:00
Don't use sub-frame timing for the video clock
This commit is contained in:
parent
582efcdb9b
commit
71ff90aaee
2 changed files with 8 additions and 14 deletions
|
@ -119,10 +119,7 @@ static double get_audio_clock(VideoState *is)
|
|||
|
||||
static double get_video_clock(VideoState *is)
|
||||
{
|
||||
double delta;
|
||||
|
||||
delta = (av_gettime() - is->video_current_pts_time) / 1000000.0;
|
||||
return is->video_current_pts + delta;
|
||||
return is->video_current_pts;
|
||||
}
|
||||
|
||||
static double get_external_clock(VideoState *is)
|
||||
|
@ -469,9 +466,6 @@ void VideoState::video_refresh_timer()
|
|||
|
||||
vp = &this->pictq[this->pictq_rindex];
|
||||
|
||||
this->video_current_pts = vp->pts;
|
||||
this->video_current_pts_time = av_gettime();
|
||||
|
||||
delay = vp->pts - this->frame_last_pts; /* the pts from last time */
|
||||
if(delay <= 0 || delay >= 1.0) {
|
||||
/* if incorrect delay, use previous one */
|
||||
|
@ -481,6 +475,8 @@ void VideoState::video_refresh_timer()
|
|||
this->frame_last_delay = delay;
|
||||
this->frame_last_pts = vp->pts;
|
||||
|
||||
this->video_current_pts = vp->pts;
|
||||
|
||||
/* update delay to sync to audio if not master source */
|
||||
if(this->av_sync_type != AV_SYNC_VIDEO_MASTER)
|
||||
{
|
||||
|
@ -750,7 +746,6 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
|||
|
||||
this->frame_timer = (double)av_gettime() / 1000000.0;
|
||||
this->frame_last_delay = 40e-3;
|
||||
this->video_current_pts_time = av_gettime();
|
||||
|
||||
codecCtx->get_buffer = our_get_buffer;
|
||||
codecCtx->release_buffer = our_release_buffer;
|
||||
|
|
|
@ -58,9 +58,9 @@ namespace MWRender
|
|||
: videoStream(-1), audioStream(-1), av_sync_type(0), external_clock_base(0),
|
||||
audio_clock(0), audio_st(NULL), audio_diff_cum(0), audio_diff_avg_coef(0),
|
||||
audio_diff_threshold(0), audio_diff_avg_count(0), frame_timer(0), frame_last_pts(0),
|
||||
frame_last_delay(0), video_clock(0), video_current_pts(0), video_current_pts_time(0),
|
||||
video_st(NULL), rgbaFrame(NULL), pictq_size(0), pictq_rindex(0), pictq_windex(0),
|
||||
quit(false), refresh(0), format_ctx(0), sws_context(NULL), display_ready(0)
|
||||
frame_last_delay(0), video_clock(0), video_current_pts(0), video_st(NULL),
|
||||
rgbaFrame(NULL), pictq_size(0), pictq_rindex(0), pictq_windex(0), quit(false),
|
||||
refresh(0), format_ctx(0), sws_context(NULL), display_ready(0)
|
||||
{}
|
||||
|
||||
~VideoState()
|
||||
|
@ -68,8 +68,8 @@ namespace MWRender
|
|||
audioq.flush();
|
||||
videoq.flush();
|
||||
|
||||
if(pictq_size >= 1)
|
||||
free(pictq[0].data);
|
||||
for(int i = 0;i < VIDEO_PICTURE_QUEUE_SIZE;i++)
|
||||
free(pictq[i].data);
|
||||
}
|
||||
|
||||
void init(const std::string& resourceName);
|
||||
|
@ -112,7 +112,6 @@ namespace MWRender
|
|||
double frame_last_delay;
|
||||
double video_clock; ///<pts of last decoded frame / predicted pts of next decoded frame
|
||||
double video_current_pts; ///<current displayed pts (different from video_clock if frame fifos are used)
|
||||
int64_t video_current_pts_time; ///<time (av_gettime) at which we updated video_current_pts - used to have running video pts
|
||||
AVStream *video_st;
|
||||
PacketQueue videoq;
|
||||
|
||||
|
|
Loading…
Reference in a new issue