diff options
author | chriszero <zerov83@gmail.com> | 2015-11-07 16:48:56 +0100 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-11-07 16:48:56 +0100 |
commit | 135ed5d0ce1613f70f4b2ddcb9e8bca721ffca9e (patch) | |
tree | 26ceac984c64478210d8996d551d2be93d5cbc14 | |
parent | f7432aedbd74d83ec92dc72750d1e755a699c25a (diff) | |
download | vdr-plugin-plex-135ed5d0ce1613f70f4b2ddcb9e8bca721ffca9e.tar.gz vdr-plugin-plex-135ed5d0ce1613f70f4b2ddcb9e8bca721ffca9e.tar.bz2 |
Changed calculation of ResizeRingbuffer
-rw-r--r-- | hlsPlayer.cpp | 17 | ||||
-rw-r--r-- | hlsPlayer.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/hlsPlayer.cpp b/hlsPlayer.cpp index b165bce..5b650e3 100644 --- a/hlsPlayer.cpp +++ b/hlsPlayer.cpp @@ -7,6 +7,7 @@ #include <pcrecpp.h> #include <algorithm> +#include <fstream> #include "Plexservice.h" #include "XmlObject.h" @@ -340,7 +341,7 @@ bool cHlsSegmentLoader::DoLoad(void) } } else { if(nextSegmentSize >= m_ringBufferSize) { - ResizeRingbuffer(nextSegmentSize + MEGABYTE(1)); + ResizeRingbuffer(nextSegmentSize + m_ringBufferSize - m_pRingbuffer->Free() + MEGABYTE(1)); } } m_bufferFilled = result; @@ -446,12 +447,20 @@ cHlsPlayer::cHlsPlayer(std::string startm3u8, plexclient::Video Video, int offse m_isBuffering = false; AudioIndexOffset = 1000; // Just a magic number m_tTimer.Set(1); + m_pDebugFile = NULL; + + //m_pDebugFile = new std::ofstream(); + //m_pDebugFile->open("debug.ts", std::ios::out); } cHlsPlayer::~cHlsPlayer() { dsyslog("[plex]: '%s'", __FUNCTION__); Cancel(); + if(m_pDebugFile) m_pDebugFile->close(); + delete m_pDebugFile; + m_pDebugFile = NULL; + delete m_pSegmentLoader; m_pSegmentLoader = NULL; Detach(); @@ -538,6 +547,11 @@ bool cHlsPlayer::DoPlay(void) uchar* toPlay = m_pSegmentLoader->m_pRingbuffer->Get(bytesAvaliable); if(bytesAvaliable >= TS_SIZE) { int playedBytes = PlayTs(toPlay, TS_SIZE, false); + // save stream to disk to debug data + if(m_pDebugFile) { + m_pDebugFile-> write((char*)toPlay, playedBytes); + } + m_pSegmentLoader->m_pRingbuffer->Del(playedBytes); res = true; } else { @@ -567,6 +581,7 @@ bool cHlsPlayer::GetIndex(int& Current, int& Total, bool SnapToIFrame __attribut Total = m_pSegmentLoader->GetStreamLenght() * FramesPerSecond(); } Current = GetPlayedSeconds() * FramesPerSecond(); + std::cout << "FPS: " << FramesPerSecond() << "STC: " << this->DeviceGetSTC() << std::endl; return true; } diff --git a/hlsPlayer.h b/hlsPlayer.h index f08505a..1e88deb 100644 --- a/hlsPlayer.h +++ b/hlsPlayer.h @@ -75,6 +75,7 @@ public: class cHlsPlayer : public cPlayer, cThread { private: + std::ofstream* m_pDebugFile; int AudioIndexOffset; cHlsSegmentLoader* m_pSegmentLoader; plexclient::Video m_Video; |