Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 24th, 2012  |  syntax: C++  |  size: 1.99 KB  |  views: 308  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ---  a/xbmc/cores/omxplayer/OMXPlayer.cpp       2012-09-23 00:24:51.000000000 +0100
  2. +++  b/xbmc/cores/omxplayer/OMXPlayer.cpp       2012-09-23 10:38:26.000000000 +0100
  3. @@ -1182,10 +1182,14 @@
  4.          continue;
  5.        }
  6.  
  7. -      // always yield to players if they have data
  8.        if((m_player_audio.HasData() || m_CurrentAudio.id < 0)
  9.        && (m_player_video.HasData() || m_CurrentVideo.id < 0))
  10. -        Sleep(0);
  11. +        {
  12. +          if(65537 > m_State.fscache_bytes > 32768)
  13. +            Sleep(50); // Yield 50ms to give almost empty filecache time
  14. +          else         // to fill before our next read from it.
  15. +            Sleep(0);  // Always yield to players if they have data.
  16. +        }
  17.  
  18.        DemuxPacket* pPacket = NULL;
  19.        CDemuxStream *pStream = NULL;
  20. @@ -3849,12 +3853,16 @@
  21.    XFILE::SCacheStatus status;
  22.    if(m_pInputStream && m_pInputStream->GetCacheStatus(&status))
  23.    {
  24. +    state.fscache_bytes = status.forward;
  25.      state.cache_bytes = status.forward;
  26.      if(state.time_total)
  27.        state.cache_bytes += m_pInputStream->GetLength() * GetQueueTime() / state.time_total;
  28.    }
  29.    else
  30. +  {
  31.      state.cache_bytes = 0;
  32. +    state.fscache_bytes = 0;
  33. +  }
  34.  
  35.    state.timestamp = m_av_clock.GetAbsoluteClock();
  36.  
  37. ---  a/xbmc/cores/omxplayer/OMXPlayer.h 2012-09-23 09:12:44.000000000 +0100
  38. +++  b/xbmc/cores/omxplayer/OMXPlayer.h 2012-09-23 10:39:10.000000000 +0100
  39. @@ -378,6 +378,7 @@
  40.        recording     = false;
  41.        demux_video   = "";
  42.        demux_audio   = "";
  43. +      fscache_bytes = 0;
  44.        cache_bytes   = 0;
  45.        cache_level   = 0.0;
  46.        cache_delay   = 0.0;
  47. @@ -403,6 +404,7 @@
  48.      std::string demux_video;
  49.      std::string demux_audio;
  50.  
  51. +    int64_t fscache_bytes; // number of bytes currently cached in filesystem.
  52.      int64_t cache_bytes;   // number of bytes current's cached
  53.      double  cache_level;   // current estimated required cache level
  54.      double  cache_delay;   // time until cache is expected to reach estimated level