Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoPlayer: drop some outdated pullup correction code that does more… #10651

Merged
merged 1 commit into from
Oct 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions xbmc/cores/VideoPlayer/DVDTSCorrection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ void CPullupCorrection::Flush()
{
m_pattern.clear();
m_ringpos = 0;
m_ptscorrection = 0.0;
m_prevpts = DVD_NOPTS_VALUE;
m_patternpos = 0;
m_ringfill = 0;
m_haspattern = false;
m_patternlength = 0;
m_frameduration = DVD_NOPTS_VALUE;
m_trackingpts = DVD_NOPTS_VALUE;
memset(m_diffring, 0, sizeof(m_diffring));
}

Expand Down Expand Up @@ -126,35 +124,7 @@ void CPullupCorrection::Add(double pts)
}
}

//calculate where we are in the pattern
double ptsinpattern = 0.0;
for (int i = 0; i < m_patternpos; i++)
ptsinpattern += m_pattern[m_pattern.size() - i - 1];

m_frameduration = CalcFrameDuration();

//correct the last pts based on where we should be according to the frame duration
m_ptscorrection = (m_frameduration * m_patternpos) - ptsinpattern;

double corrpts = pts + m_ptscorrection;
if (m_trackingpts != DVD_NOPTS_VALUE)
{
//set the tracked pts a frame duration forward
m_trackingpts += m_frameduration;

//if the tracked pts differs too much from the corrected one,
//move the tracked pts slowly towards the corrected one
//this allows the timestamps to wobble slightly
if (fabs(m_trackingpts - corrpts) > MAXERR)
m_trackingpts += (corrpts - m_trackingpts) * 0.005;

//set m_ptscorrection so that pts + m_ptscorrection = m_trackingpts
m_ptscorrection = m_trackingpts - pts;
}
else
{
m_trackingpts = corrpts;
}
}

//gets a diff diffnr into the past
Expand Down
3 changes: 0 additions & 3 deletions xbmc/cores/VideoPlayer/DVDTSCorrection.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class CPullupCorrection
void Flush(); //flush the saved pattern and the ringbuffer
void ResetVFRDetection(void);

double GetCorrection() { return m_ptscorrection; }
int GetPatternLength() { return m_patternlength; }
double GetFrameDuration() { return m_frameduration; }
double GetMaxFrameDuration(void) { return m_maxframeduration; }
Expand Down Expand Up @@ -66,8 +65,6 @@ class CPullupCorrection

std::vector<double> m_pattern, m_lastPattern; //the last saved pattern
int m_patternpos; //the position of the pattern in the ringbuffer, moves one to the past each time a pts is added
double m_ptscorrection; //the correction needed for the last added pts
double m_trackingpts; //tracked pts for smoothing the timestamps
double m_frameduration; //frameduration exposed to VideoPlayer, used for calculating the fps
double m_maxframeduration; //Max value detected for frame duration (for VFR files case)
double m_minframeduration; //Min value detected for frame duration (for VFR files case)
Expand Down
8 changes: 1 addition & 7 deletions xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,14 +799,8 @@ int CVideoPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)

int result = 0;

//correct any pattern in the timestamps
if (picture.format != RENDER_FMT_BYPASS)
{
m_pullupCorrection.Add(pts);
pts += m_pullupCorrection.GetCorrection();
}

//try to calculate the framerate
m_pullupCorrection.Add(pts);
if (!m_stalled)
CalcFrameRate();

Expand Down