summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian <zerov83@gmail.com>2016-01-16 16:45:20 +0100
committerChristian <zerov83@gmail.com>2016-01-16 16:45:20 +0100
commit9af45891dc7d341b0e28a6587352e062556c0d68 (patch)
tree0a59f697cbeb580a020851e49d3203731a5cf43c
parent1bfca714582afaa635906592a9dcf331eab489ac (diff)
downloadvdr-plugin-plex-9af45891dc7d341b0e28a6587352e062556c0d68.tar.gz
vdr-plugin-plex-9af45891dc7d341b0e28a6587352e062556c0d68.tar.bz2
Fixes player bug.
-rw-r--r--hlsPlayer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/hlsPlayer.cpp b/hlsPlayer.cpp
index 6bd0753..c0cd423 100644
--- a/hlsPlayer.cpp
+++ b/hlsPlayer.cpp
@@ -17,6 +17,7 @@
#include "Stream.h"
static cMutex hlsMutex;
+const int BUFFERSIZE = 8192;
//--- cHlsSegmentLoader
@@ -29,7 +30,7 @@ cHlsSegmentLoader::cHlsSegmentLoader(std::string startm3u8, plexclient::Video* p
m_segmentsToBuffer = 2;
m_streamlenght = 0;
m_lastSegmentSize = 0;
- m_pBuffer = new uchar[8192];
+ m_pBuffer = new uchar[BUFFERSIZE];
// Initialize members
m_pClientSession = NULL;
@@ -243,21 +244,24 @@ bool cHlsSegmentLoader::LoadSegment(std::string segmentUri)
esyslog("[plex] %s; %s failed.", __FUNCTION__, segmentUri.c_str());
return false;
}
- dsyslog("[plex] %s: %s successfully.", __FUNCTION__, segmentUri.c_str());
if(segmentResponse.getContentLength() <= TS_SIZE) {
// Empty segment
+ dsyslog("[plex] %s: %s <= 188 byte.", __FUNCTION__, segmentUri.c_str());
return true;
}
+
+ dsyslog("[plex] %s: %s successfully.", __FUNCTION__, segmentUri.c_str());
// copy response
- segmentFile.read(reinterpret_cast<char*>(m_pBuffer), sizeof(m_pBuffer));
+ segmentFile.read(reinterpret_cast<char*>(m_pBuffer), BUFFERSIZE);
std::streamsize n = segmentFile.gcount();
while(n > 0) {
if(m_pRingbuffer->Free() >= n) {
m_pRingbuffer->Put(m_pBuffer, n);
-
- segmentFile.read(reinterpret_cast<char*>(m_pBuffer), sizeof(m_pBuffer));
+
+ segmentFile.read(reinterpret_cast<char*>(m_pBuffer), BUFFERSIZE);
n = segmentFile.gcount();
+ m_bufferFilled = true;
}
else {
cCondWait::SleepMs(1);