--- a/xbmc/cores/omxplayer/OMXPlayer.cpp 2012-09-23 00:24:51.000000000 +0100
+++ b/xbmc/cores/omxplayer/OMXPlayer.cpp 2012-09-23 10:38:26.000000000 +0100
@@ -1182,10 +1182,14 @@
continue;
}
- // always yield to players if they have data
if((m_player_audio.HasData() || m_CurrentAudio.id < 0)
&& (m_player_video.HasData() || m_CurrentVideo.id < 0))
- Sleep(0);
+ {
+ if(65537 > m_State.fscache_bytes > 32768)
+ Sleep(50); // Yield 50ms to give almost empty filecache time
+ else // to fill before our next read from it.
+ Sleep(0); // Always yield to players if they have data.
+ }
DemuxPacket* pPacket = NULL;
CDemuxStream *pStream = NULL;
@@ -3849,12 +3853,16 @@
XFILE::SCacheStatus status;
if(m_pInputStream && m_pInputStream->GetCacheStatus(&status))
{
+ state.fscache_bytes = status.forward;
state.cache_bytes = status.forward;
if(state.time_total)
state.cache_bytes += m_pInputStream->GetLength() * GetQueueTime() / state.time_total;
}
else
+ {
state.cache_bytes = 0;
+ state.fscache_bytes = 0;
+ }
state.timestamp = m_av_clock.GetAbsoluteClock();
--- a/xbmc/cores/omxplayer/OMXPlayer.h 2012-09-23 09:12:44.000000000 +0100
+++ b/xbmc/cores/omxplayer/OMXPlayer.h 2012-09-23 10:39:10.000000000 +0100
@@ -378,6 +378,7 @@
recording = false;
demux_video = "";
demux_audio = "";
+ fscache_bytes = 0;
cache_bytes = 0;
cache_level = 0.0;
cache_delay = 0.0;
@@ -403,6 +404,7 @@
std::string demux_video;
std::string demux_audio;
+ int64_t fscache_bytes; // number of bytes currently cached in filesystem.
int64_t cache_bytes; // number of bytes current's cached
double cache_level; // current estimated required cache level
double cache_delay; // time until cache is expected to reach estimated level