Merge branch 'development' into LTS_development
# Conflicts: # src/output/output_progressive_mp4.cpp
This commit is contained in:
commit
2717c21d4e
16 changed files with 55 additions and 32 deletions
|
@ -24,6 +24,7 @@
|
|||
|
||||
namespace Mist {
|
||||
inputBuffer::inputBuffer(Util::Config * cfg) : Input(cfg) {
|
||||
liveMeta = 0;
|
||||
capa["name"] = "Buffer";
|
||||
JSON::Value option;
|
||||
option["arg"] = "integer";
|
||||
|
@ -138,10 +139,11 @@ namespace Mist {
|
|||
}
|
||||
}
|
||||
}
|
||||
char pageName[NAME_BUFFER_SIZE];
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
||||
IPC::semaphore liveMeta(pageName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
liveMeta.unlink();
|
||||
if (liveMeta){
|
||||
liveMeta->unlink();
|
||||
delete liveMeta;
|
||||
liveMeta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,13 +165,9 @@ namespace Mist {
|
|||
memset(tmp.mapped, 0xFF, size);
|
||||
}
|
||||
}
|
||||
|
||||
//Delete the live stream semaphore, if any.
|
||||
if (liveMeta){liveMeta->unlink();}
|
||||
{
|
||||
//Delete the live stream semaphore, if any.
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
||||
IPC::semaphore liveMeta(pageName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
liveMeta.unlink();
|
||||
}{
|
||||
//Delete the stream index metapage.
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
|
||||
IPC::sharedPage erasePage(pageName, DEFAULT_STRM_PAGE_SIZE, false, false);
|
||||
|
@ -336,10 +334,13 @@ namespace Mist {
|
|||
myMeta.bufferWindow = lastms - firstms;
|
||||
myMeta.vod = false;
|
||||
myMeta.live = true;
|
||||
static char liveSemName[NAME_BUFFER_SIZE];
|
||||
snprintf(liveSemName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
||||
IPC::semaphore liveMeta(liveSemName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
liveMeta.wait();
|
||||
if (!liveMeta){
|
||||
static char liveSemName[NAME_BUFFER_SIZE];
|
||||
snprintf(liveSemName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
||||
liveMeta = new IPC::semaphore(liveSemName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
}
|
||||
liveMeta->wait();
|
||||
|
||||
if (!nProxy.metaPages.count(0) || !nProxy.metaPages[0].mapped) {
|
||||
char pageName[NAME_BUFFER_SIZE];
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
|
||||
|
@ -348,7 +349,7 @@ namespace Mist {
|
|||
}
|
||||
myMeta.writeTo(nProxy.metaPages[0].mapped);
|
||||
memset(nProxy.metaPages[0].mapped + myMeta.getSendLen(), 0, (nProxy.metaPages[0].len > myMeta.getSendLen() ? std::min(nProxy.metaPages[0].len - myMeta.getSendLen(), 4ll) : 0));
|
||||
liveMeta.post();
|
||||
liveMeta->post();
|
||||
}
|
||||
|
||||
///Checks if removing a key from this track is allowed/safe, and if so, removes it.
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Mist {
|
|||
unsigned int lastReTime; /*LTS*/
|
||||
bool hasPush;
|
||||
bool resumeMode;
|
||||
IPC::semaphore * liveMeta;
|
||||
protected:
|
||||
//Private Functions
|
||||
bool setup();
|
||||
|
|
|
@ -757,10 +757,6 @@ namespace Mist {
|
|||
std::stringstream rangeReply;
|
||||
rangeReply << "bytes " << byteStart << "-" << byteEnd << "/" << fileSize;
|
||||
H.SetHeader("Content-Length", byteEnd - byteStart + 1);
|
||||
//do not multiplex requests that are > 1MiB
|
||||
if (byteEnd - byteStart + 1 > 1024 * 1024) {
|
||||
H.SetHeader("MistMultiplex", "No");
|
||||
}
|
||||
H.SetHeader("Content-Range", rangeReply.str());
|
||||
/// \todo Switch to chunked?
|
||||
H.SendResponse("206", "Partial content", myConn);
|
||||
|
@ -770,8 +766,6 @@ namespace Mist {
|
|||
if (!myMeta.live) {
|
||||
H.SetHeader("Content-Length", byteEnd - byteStart + 1);
|
||||
}
|
||||
//do not multiplex requests that aren't ranged
|
||||
H.SetHeader("MistMultiplex", "No");
|
||||
/// \todo Switch to chunked?
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
//HTTP_S.StartResponse(HTTP_R, conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue