xbmc: add upstream patch

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-06-13 09:45:33 +02:00
parent b7917d3903
commit 90cb50e229

View File

@ -0,0 +1,300 @@
diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.cpp xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.cpp
--- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.cpp 2013-05-02 17:00:07.000000000 +0200
+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.cpp 2013-06-12 23:56:33.134924673 +0200
@@ -76,7 +76,6 @@
m_buffer_empty = false;
m_nChannels = 0;
m_DecoderOpen = false;
- m_freq = CurrentHostFrequency();
m_bad_state = false;
m_hints_current.Clear();
@@ -135,20 +134,11 @@
m_speed = DVD_PLAYSPEED_NORMAL;
m_audioClock = 0;
- m_error = 0;
- m_errorbuff = 0;
- m_errorcount = 0;
- m_integral = 0;
- m_skipdupcount = 0;
- m_prevskipped = false;
- m_syncclock = true;
m_hw_decode = false;
- m_errortime = CurrentHostCounter();
m_silence = false;
m_started = false;
m_flush = false;
m_nChannels = 0;
- m_synctype = SYNC_DISCON;
m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
m_use_passthrough = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) ? true : false ;
m_use_hw_decode = g_advancedSettings.m_omxHWAudioDecode;
@@ -190,110 +180,6 @@
CLog::Log(LOGNOTICE, "thread end: OMXPlayerAudio::OnExit()");
}
-
-
-void OMXPlayerAudio::HandleSyncError(double duration)
-{
- double clock = m_av_clock->GetClock();
- double error = m_audioClock - clock;
- int64_t now;
-
- if( fabs(error) > DVD_MSEC_TO_TIME(100) || m_syncclock )
- {
- m_av_clock->Discontinuity(clock+error);
- /*
- if(m_speed == DVD_PLAYSPEED_NORMAL)
- CLog::Log(LOGDEBUG, "OMXPlayerAudio:: Discontinuity - was:%f, should be:%f, error:%f\n", clock, clock+error, error);
- */
-
- m_errorbuff = 0;
- m_errorcount = 0;
- m_skipdupcount = 0;
- m_error = 0;
- m_syncclock = false;
- m_errortime = CurrentHostCounter();
-
- return;
- }
-
- if (m_speed != DVD_PLAYSPEED_NORMAL)
- {
- m_errorbuff = 0;
- m_errorcount = 0;
- m_integral = 0;
- m_skipdupcount = 0;
- m_error = 0;
- m_errortime = CurrentHostCounter();
- return;
- }
-
- //check if measured error for 1 second
- now = CurrentHostCounter();
- if ((now - m_errortime) >= m_freq)
- {
- m_errortime = now;
- m_error = m_errorbuff / m_errorcount;
-
- m_errorbuff = 0;
- m_errorcount = 0;
-
- if (m_synctype == SYNC_DISCON)
- {
- double limit, error;
-
- if (m_av_clock->GetRefreshRate(&limit) > 0)
- {
- //when the videoreferenceclock is running, the discontinuity limit is one vblank period
- limit *= DVD_TIME_BASE;
-
- //make error a multiple of limit, rounded towards zero,
- //so it won't interfere with the sync methods in CXBMCRenderManager::WaitPresentTime
- if (m_error > 0.0)
- error = limit * floor(m_error / limit);
- else
- error = limit * ceil(m_error / limit);
- }
- else
- {
- limit = DVD_MSEC_TO_TIME(10);
- error = m_error;
- }
-
- /*
- limit = DVD_MSEC_TO_TIME(10);
- error = m_error;
- */
-
- if (fabs(error) > limit - 0.001)
- {
- m_av_clock->Discontinuity(clock+error);
- /*
- if(m_speed == DVD_PLAYSPEED_NORMAL)
- CLog::Log(LOGDEBUG, "COMXPlayerAudio:: Discontinuity - was:%f, should be:%f, error:%f", clock, clock+error, error);
- */
- }
- }
- /*
- else if (m_synctype == SYNC_SKIPDUP && m_skipdupcount == 0 && fabs(m_error) > DVD_MSEC_TO_TIME(10))
- if (m_skipdupcount == 0 && fabs(m_error) > DVD_MSEC_TO_TIME(10))
- {
- //check how many packets to skip/duplicate
- m_skipdupcount = (int)(m_error / duration);
- //if less than one frame off, see if it's more than two thirds of a frame, so we can get better in sync
- if (m_skipdupcount == 0 && fabs(m_error) > duration / 3 * 2)
- m_skipdupcount = (int)(m_error / (duration / 3 * 2));
-
- if (m_skipdupcount > 0)
- CLog::Log(LOGDEBUG, "OMXPlayerAudio:: Duplicating %i packet(s) of %.2f ms duration",
- m_skipdupcount, duration / DVD_TIME_BASE * 1000.0);
- else if (m_skipdupcount < 0)
- CLog::Log(LOGDEBUG, "OMXPlayerAudio:: Skipping %i packet(s) of %.2f ms duration ",
- m_skipdupcount * -1, duration / DVD_TIME_BASE * 1000.0);
- }
- */
- }
-}
-
bool OMXPlayerAudio::CodecChange()
{
unsigned int old_bitrate = m_hints.bitrate;
@@ -394,9 +280,6 @@
int n = (m_nChannels * m_hints.bitspersample * m_hints.samplerate)>>3;
if (n > 0)
m_audioClock += ((double)decoded_size * DVD_TIME_BASE) / n;
-
- if(m_speed == DVD_PLAYSPEED_NORMAL)
- HandleSyncError((((double)decoded_size * DVD_TIME_BASE) / n));
break;
}
@@ -430,9 +313,6 @@
m_omxAudio.AddPackets(pkt->pData, pkt->iSize, m_audioClock, m_audioClock);
}
- if(m_speed == DVD_PLAYSPEED_NORMAL)
- HandleSyncError(0);
-
m_audioStats.AddSampleBytes(pkt->iSize);
break;
@@ -525,18 +405,7 @@
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{ //player asked us to set internal clock
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
-
- if (pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
- m_audioClock = pMsgGeneralResync->m_timestamp;
-
- if (pMsgGeneralResync->m_clock)
- {
- CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 1)", m_audioClock);
- m_av_clock->Discontinuity(m_audioClock);
- //m_av_clock->OMXUpdateClock(m_audioClock);
- }
- else
- CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 0)", m_audioClock);
+ CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, %d)", m_audioClock, pMsgGeneralResync->m_clock);
m_flush = false;
}
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
@@ -559,7 +428,6 @@
m_omxAudio.Flush();
m_av_clock->OMXReset(false);
m_av_clock->UnLock();
- m_syncclock = true;
m_stalled = true;
m_started = false;
@@ -599,10 +467,6 @@
m_speed = static_cast<CDVDMsgInt*>(pMsg)->m_value;
CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::PLAYER_SETSPEED %d", m_speed);
}
- if (m_speed != DVD_PLAYSPEED_NORMAL)
- {
- m_syncclock = true;
- }
}
else if (pMsg->IsType(CDVDMsg::AUDIO_SILENCE))
{
diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.h xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.h
--- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.h 2013-05-02 17:00:08.000000000 +0200
+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.h 2013-06-12 23:56:33.135924691 +0200
@@ -60,19 +60,6 @@
int m_speed;
bool m_silence;
double m_audioClock;
- double m_error; //last average error
-
- int64_t m_errortime; //timestamp of last time we measured
- int64_t m_freq;
-
- void HandleSyncError(double duration);
- double m_errorbuff; //place to store average errors
- int m_errorcount;//number of errors stored
- bool m_syncclock;
-
- double m_integral; //integral correction for resampler
- int m_skipdupcount; //counter for skip/duplicate synctype
- bool m_prevskipped;
bool m_stalled;
bool m_started;
@@ -82,8 +69,6 @@
struct timespec m_starttime, m_endtime;
bool m_buffer_empty;
bool m_flush;
- //SYNC_DISCON, SYNC_SKIPDUP, SYNC_RESAMPLE
- int m_synctype;
int m_nChannels;
bool m_DecoderOpen;
diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.cpp xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.cpp
--- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.cpp 2013-05-02 17:00:07.000000000 +0200
+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.cpp 2013-06-13 00:11:56.443044388 +0200
@@ -89,7 +89,6 @@
m_iVideoDelay = 0;
m_droptime = 0.0;
m_dropbase = 0.0;
- m_autosync = 1;
m_fForcedAspectRatio = 0.0f;
m_messageQueue.SetMaxDataSize(10 * 1024 * 1024);
m_messageQueue.SetMaxTimeSize(8.0);
@@ -115,7 +114,6 @@
m_started = false;
m_flush = false;
m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
- m_autosync = 1;
m_iSleepEndTime = DVD_NOPTS_VALUE;
// force SetVideoRect to be called initially
m_dst_rect.SetRect(0, 0, 0, 0);
@@ -280,11 +278,6 @@
iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500));
iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500));
- if( m_stalled )
- iSleepTime = iFrameSleep;
- else
- iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync;
-
// present the current pts of this frame to user, and include the actual
// presentation delay, to allow him to adjust for it
if( m_stalled )
@@ -398,22 +391,7 @@
else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC))
{
CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg;
-
- if(pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE)
- pts = pMsgGeneralResync->m_timestamp;
-
- double delay = m_FlipTimeStamp - m_av_clock->GetAbsoluteClock();
- if( delay > frametime ) delay = frametime;
- else if( delay < 0 ) delay = 0;
-
- if(pMsgGeneralResync->m_clock)
- {
- CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 1)", pts);
- m_av_clock->Discontinuity(pts - delay);
- //m_av_clock->OMXUpdateClock(pts - delay);
- }
- else
- CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 0)", pts);
+ CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, %d)", pts, pMsgGeneralResync->m_clock);
pMsgGeneralResync->Release();
continue;
diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.h xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.h
--- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.h 2013-05-02 17:00:07.000000000 +0200
+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.h 2013-06-12 23:57:42.278013434 +0200
@@ -66,7 +66,6 @@
std::string m_codecname;
double m_droptime;
double m_dropbase;
- unsigned int m_autosync;
double m_iSubtitleDelay;
bool m_bRenderSubs;
bool m_bAllowFullscreen;