From de617db74a8b9a86f18aca302238ddcf4be9ed91 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 3 Dec 2013 16:27:35 +0100 Subject: [PATCH] Spurious bugfixes for live support. --- src/buffer/buffer.cpp | 3 +-- src/buffer/buffer_stream.cpp | 16 ++++++++++------ src/connectors/conn_http_progressive_flv.cpp | 2 +- src/connectors/conn_http_smooth.cpp | 8 ++++---- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/buffer/buffer.cpp b/src/buffer/buffer.cpp index 3ecb39f2..c77137eb 100644 --- a/src/buffer/buffer.cpp +++ b/src/buffer/buffer.cpp @@ -197,8 +197,7 @@ namespace Buffer { usr->curr_down = (usr->tmpStats.down - usr->lastStats.down) / secs; usr->lastStats = usr->tmpStats; thisStream->saveStats(usr->sID, usr->tmpStats); - //TODO: Re-enable this - //thisStream->sendMeta(usr->S); + thisStream->sendMeta(usr->S); break; } case 't': { diff --git a/src/buffer/buffer_stream.cpp b/src/buffer/buffer_stream.cpp index d426963f..b17c54a7 100644 --- a/src/buffer/buffer_stream.cpp +++ b/src/buffer/buffer_stream.cpp @@ -61,13 +61,17 @@ namespace Buffer { Storage["totals"]["now"] = now; Storage["buffer"] = name; - std::map::iterator it; - for (it = metadata.tracks.begin(); it != metadata.tracks.end(); ++it){ - std::cout << it->second.getIdentifier() << ": " << it->second.firstms << "-" << it->second.lastms << " (" << it->second.keys.size() << ")" << std::endl; - } - Storage["meta"] = metadata.toJSON(); - + if (Storage["meta"].isMember("tracks")){ + for (JSON::ObjIter oIt = Storage["meta"]["tracks"].ObjBegin(); oIt != Storage["meta"]["tracks"].ObjEnd(); ++oIt){ + oIt->second.removeMember("fragments"); + oIt->second.removeMember("keys"); + oIt->second.removeMember("parts"); + oIt->second.removeMember("idheader"); + oIt->second.removeMember("commentheader"); + } + } + ret = Storage.toString(); Storage["log"].null(); return ret; diff --git a/src/connectors/conn_http_progressive_flv.cpp b/src/connectors/conn_http_progressive_flv.cpp index a4a8f5a9..ff97b5c6 100644 --- a/src/connectors/conn_http_progressive_flv.cpp +++ b/src/connectors/conn_http_progressive_flv.cpp @@ -134,7 +134,7 @@ namespace Connector_HTTP { unsigned int now = Util::epoch(); if (now != lastStats){ lastStats = now; - ss.SendNow(conn.getStats("HTTP_Progressive_FLV").c_str()); + ss.SendNow(conn.getStats("HTTP_Progressive_FLV")); } if (ss.spool()){ while (Strm.parsePacket(ss.Received())){ diff --git a/src/connectors/conn_http_smooth.cpp b/src/connectors/conn_http_smooth.cpp index 0f242953..e2482ba5 100644 --- a/src/connectors/conn_http_smooth.cpp +++ b/src/connectors/conn_http_smooth.cpp @@ -209,6 +209,7 @@ namespace Connector_HTTP { ready4data = false; continue; } + ready4data = true; ss.setBlocking(false); Strm.waitForMeta(ss); for (std::map::iterator it = Strm.metadata.tracks.begin(); it != Strm.metadata.tracks.end(); it++){ @@ -286,7 +287,7 @@ namespace Connector_HTTP { long long mstime = 0; long long mslen = 0; - for (std::deque::iterator it = myRef.keys.end(); it != myRef.keys.end(); it++){ + for (std::deque::iterator it = myRef.keys.begin(); it != myRef.keys.end(); it++){ if (it->getTime() >= (requestedTime / 10000)){ mstime = it->getTime(); mslen = it->getLength(); @@ -446,7 +447,6 @@ namespace Connector_HTTP { HTTP_S.SendResponse("200", "OK", conn); } } - ready4data = true; //Clean for any possible next requests HTTP_R.Clean(); } @@ -461,9 +461,9 @@ namespace Connector_HTTP { if (now != lastStats){ //Send new stats. lastStats = now; - ss.SendNow(conn.getStats("HTTP_Smooth").c_str()); + ss.SendNow(conn.getStats("HTTP_Smooth")); } - if (/*handlingRequest &&*/ ss.spool()){ + if (ss.spool()){ while (Strm.parsePacket(ss.Received())){ if (Strm.lastType() == DTSC::AUDIO || Strm.lastType() == DTSC::VIDEO){ HTTP_S.Chunkify(Strm.lastData(), conn);