Fixed general output shutdown behaviour and logging on end of stream, MP4 output now correctly ends HTTP response on stream end.

Bugfix in HTTP::Parser when calling Chunkify before initializing
This commit is contained in:
Thulinma 2020-10-20 20:46:29 +02:00
parent 9c71b25c06
commit dc0cd0d451
4 changed files with 13 additions and 7 deletions

View file

@ -37,6 +37,7 @@ void HTTP::Parser::CleanPreserveHeaders(){
seenReq = false; seenReq = false;
possiblyComplete = false; possiblyComplete = false;
getChunks = false; getChunks = false;
sendingChunks = false;
doingChunk = 0; doingChunk = 0;
bufferChunks = false; bufferChunks = false;
method = "GET"; method = "GET";

View file

@ -1307,7 +1307,7 @@ namespace Mist{
} }
sendNext(); sendNext();
}else{ }else{
Util::logExitReason("end of stream"); parseData = false;
/*LTS-START*/ /*LTS-START*/
if (Triggers::shouldTrigger("CONN_STOP", streamName)){ if (Triggers::shouldTrigger("CONN_STOP", streamName)){
std::string payload = std::string payload =
@ -1315,7 +1315,10 @@ namespace Mist{
Triggers::doTrigger("CONN_STOP", payload, streamName); Triggers::doTrigger("CONN_STOP", payload, streamName);
} }
/*LTS-END*/ /*LTS-END*/
if (!onFinish()){break;} if (!onFinish()){
Util::logExitReason("end of stream");
break;
}
} }
} }
if (!meta){ if (!meta){

View file

@ -942,6 +942,12 @@ namespace Mist{
H.Chunkify(mdatHeader, 8, myConn); H.Chunkify(mdatHeader, 8, myConn);
} }
bool OutMP4::onFinish(){
H.Chunkify(0, 0, myConn);
wantRequest = true;
return true;
}
void OutMP4::onHTTP(){ void OutMP4::onHTTP(){
std::string dl; std::string dl;
if (H.GetVar("dl").size()){ if (H.GetVar("dl").size()){
@ -1226,11 +1232,6 @@ namespace Mist{
} }
} }
if (leftOver < 1){
// stop playback, wait for new request
stop();
wantRequest = true;
}
} }
void OutMP4::sendHeader(){ void OutMP4::sendHeader(){

View file

@ -99,6 +99,7 @@ namespace Mist{
void onHTTP(); void onHTTP();
void sendNext(); void sendNext();
void sendHeader(); void sendHeader();
virtual bool onFinish();
protected: protected:
uint64_t fileSize; uint64_t fileSize;