diff options
Diffstat (limited to 'hlsPlayer.cpp')
-rw-r--r-- | hlsPlayer.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hlsPlayer.cpp b/hlsPlayer.cpp index 4a19a2a..8e0892c 100644 --- a/hlsPlayer.cpp +++ b/hlsPlayer.cpp @@ -7,6 +7,7 @@ #include <pcrecpp.h> #include <algorithm> +#include <fstream> #include "Plexservice.h" #include "XmlObject.h" @@ -438,12 +439,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(); @@ -530,6 +539,10 @@ 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 { |