From 401fe65979eb42a58c38048d36f611f48a369ba7 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 25 Dec 2015 14:37:32 +0100 Subject: [PATCH] - Made HLS no longer skip first fragment. - Ignore metadata tracks and invalid tracks for buffer calculations. - Fixed statistics. --- lib/shared_memory.cpp | 4 ++-- lib/shared_memory.h | 2 +- src/input/input_buffer.cpp | 1 + src/output/output.cpp | 3 ++- src/output/output_hls.cpp | 5 ----- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index fb0189df..f82f776f 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -652,13 +652,13 @@ namespace IPC { ///\brief Sets checksum field void statExchange::crc(unsigned int sum) { - htobl(data + 186, sum); + htobl(data + 168, sum); } ///\brief Gets checksum field unsigned int statExchange::crc() { unsigned int result; - btohl(data + 186, result); + btohl(data + 168, result); return result; } diff --git a/lib/shared_memory.h b/lib/shared_memory.h index 81b2b162..333daddf 100644 --- a/lib/shared_memory.h +++ b/lib/shared_memory.h @@ -11,7 +11,7 @@ #include #endif -#define STAT_EX_SIZE 172 +#define STAT_EX_SIZE 174 #define PLAY_EX_SIZE 2+6*SIMUL_TRACKS namespace IPC { diff --git a/src/input/input_buffer.cpp b/src/input/input_buffer.cpp index 37561e14..db665105 100644 --- a/src/input/input_buffer.cpp +++ b/src/input/input_buffer.cpp @@ -57,6 +57,7 @@ namespace Mist { long long unsigned int firstms = 0xFFFFFFFFFFFFFFFFull; long long unsigned int lastms = 0; for (std::map::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) { + if (it->second.type == "meta" || !it->second.type.size()){continue;} if (it->second.init.size()){ if (!initData.count(it->first) || initData[it->first] != it->second.init){ initData[it->first] = it->second.init; diff --git a/src/output/output.cpp b/src/output/output.cpp index b1bcabe9..19cc5c24 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -116,7 +116,7 @@ namespace Mist { /// Assumes streamName class member has been set already. /// Will start input if not currently active, calls onFail() if this does not succeed. /// After assuring stream is online, clears metaPages, then sets metaPages[0], statsPage and userClient to (hopefully) valid handles. - /// Finally, calls updateMeta() + /// Finally, calls updateMeta() and stats() void Output::reconnect(){ if (!Util::startInput(streamName)){ DEBUG_MSG(DLVL_FAIL, "Opening stream failed - aborting initalization"); @@ -142,6 +142,7 @@ namespace Mist { char userPageName[NAME_BUFFER_SIZE]; snprintf(userPageName, NAME_BUFFER_SIZE, SHM_USERS, streamName.c_str()); userClient = IPC::sharedClient(userPageName, PLAY_EX_SIZE, true); + stats(); updateMeta(); } diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index 6a6bc30c..af453b4c 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -75,13 +75,8 @@ namespace Mist { lines.push_back(line.str()); } - //skip the first fragment if live and there are more than 2 fragments. unsigned int skippedLines = 0; if (myMeta.live){ - if (lines.size() > 2){ - lines.pop_front(); - skippedLines++; - } //only print the last segment when VoD lines.pop_back(); }