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;
possiblyComplete = false;
getChunks = false;
sendingChunks = false;
doingChunk = 0;
bufferChunks = false;
method = "GET";

View file

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

View file

@ -942,6 +942,12 @@ namespace Mist{
H.Chunkify(mdatHeader, 8, myConn);
}
bool OutMP4::onFinish(){
H.Chunkify(0, 0, myConn);
wantRequest = true;
return true;
}
void OutMP4::onHTTP(){
std::string dl;
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(){

View file

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