aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2015-12-04 08:17:16 +0100
committerRainer Hochecker <fernetmenta@online.de>2015-12-04 08:17:16 +0100
commit5d25a54164d59feeb4344d1d8a87f6741e10c3b4 (patch)
treeb634db33d7334eeadf983712bec80de1c1edcdff
parentc8b3fc894ea4a78b28045d81ce0f2edf57b1e9c5 (diff)
VideoPlayer: fix false positive vfr detection
-rw-r--r--xbmc/cores/dvdplayer/DVDTSCorrection.cpp7
-rw-r--r--xbmc/cores/dvdplayer/DVDTSCorrection.h16
2 files changed, 16 insertions, 7 deletions
diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp
index a72c1e5fd8..43c052c051 100644
--- a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp
+++ b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp
@@ -38,6 +38,7 @@ void CPullupCorrection::ResetVFRDetection(void)
m_minframeduration = DVD_NOPTS_VALUE;
m_maxframeduration = DVD_NOPTS_VALUE;
m_VFRCounter = 0;
+ m_patternCounter = 0;
}
void CPullupCorrection::Flush()
@@ -89,6 +90,7 @@ void CPullupCorrection::Add(double pts)
if (m_haspattern)
{
m_VFRCounter++;
+ m_lastPattern = m_pattern;
CLog::Log(LOGDEBUG, "CPullupCorrection: pattern lost on diff %f, number of losses %i", GetDiff(0), m_VFRCounter);
Flush();
}
@@ -113,6 +115,11 @@ void CPullupCorrection::Add(double pts)
m_haspattern = true;
m_patternlength = m_pattern.size();
+ if (!CheckPattern(m_lastPattern))
+ {
+ m_patternCounter++;
+ }
+
double frameduration = CalcFrameDuration();
CLog::Log(LOGDEBUG, "CPullupCorrection: detected pattern of length %i: %s, frameduration: %f",
(int)pattern.size(), GetPatternStr().c_str(), frameduration);
diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.h b/xbmc/cores/dvdplayer/DVDTSCorrection.h
index 85a07e2f1f..7f6376dad0 100644
--- a/xbmc/cores/dvdplayer/DVDTSCorrection.h
+++ b/xbmc/cores/dvdplayer/DVDTSCorrection.h
@@ -25,6 +25,7 @@
#define DIFFRINGSIZE 120
#define VFR_DETECTION_THRESHOLD 3
+#define VFR_PATTERN_THRESHOLD 2
class CPullupCorrection
{
@@ -40,7 +41,7 @@ class CPullupCorrection
double GetMaxFrameDuration(void) { return m_maxframeduration; }
double GetMinFrameDuration(void) { return m_minframeduration; }
bool HasFullBuffer() { return m_ringfill == DIFFRINGSIZE; }
- bool VFRDetection(void) { return (m_VFRCounter >= VFR_DETECTION_THRESHOLD); }
+ bool VFRDetection(void) { return ((m_VFRCounter >= VFR_DETECTION_THRESHOLD) && (m_patternCounter >= VFR_PATTERN_THRESHOLD)); }
private:
double m_prevpts; //last pts added
@@ -63,15 +64,16 @@ class CPullupCorrection
double CalcFrameDuration(); //calculates the frame duration from m_pattern
- std::vector<double> m_pattern; //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
+ 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 dvdplayer, 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)
- bool m_haspattern; //for the log and detecting VFR files case
- int m_patternlength; //for the codec info
- int m_VFRCounter; //retry counter for VFR detection
- std::string GetPatternStr(); //also for the log
+ bool m_haspattern; //for the log and detecting VFR files case
+ int m_patternlength; //for the codec info
+ int m_VFRCounter; //retry counter for VFR detection
+ int m_patternCounter;
+ std::string GetPatternStr(); //also for the log
};