SRT push input now disconnects on track drop, kills SRT connection when shutting own for other reasons. Close both SRT and regular socket in MistOutTSSRT onFinish, so the connection is considered closed on both ends.

This commit is contained in:
Thulinma 2021-06-17 00:09:35 +02:00
parent b571d1c0c5
commit 229fed131e
2 changed files with 17 additions and 2 deletions

View file

@ -113,7 +113,6 @@ namespace Mist{
myConn.setHost(srtConn.remotehost);
if (!allowPush("")){
onFinish();
srtConn.close();
return;
}
parseData = false;
@ -125,6 +124,12 @@ namespace Mist{
timeStampOffset = 0;
}
bool OutTSSRT::onFinish(){
myConn.close();
srtConn.close();
return false;
}
OutTSSRT::~OutTSSRT(){}
static void addIntOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, size_t def = 0){
@ -305,6 +310,7 @@ namespace Mist{
if (!recvSize){
if (!srtConn){
myConn.close();
srtConn.close();
wantRequest = false;
}else{
Util::sleep(50);
@ -318,6 +324,7 @@ namespace Mist{
if (!thisPacket){
INFO_MSG("Could not get TS packet");
myConn.close();
srtConn.close();
wantRequest = false;
return;
}
@ -344,6 +351,13 @@ namespace Mist{
}
}
bool OutTSSRT::dropPushTrack(uint32_t trackId, const std::string & dropReason){
Util::logExitReason("track dropped by buffer");
myConn.close();
srtConn.close();
return Output::dropPushTrack(trackId, dropReason);
}
void OutTSSRT::connStats(uint64_t now, Comms::Connections &statComm){
if (!srtConn){return;}
statComm.setUp(srtConn.dataUp());

View file

@ -14,11 +14,12 @@ namespace Mist{
void sendTS(const char *tsData, size_t len = 188);
bool isReadyForPlay(){return true;}
virtual void requestHandler();
virtual bool onFinish();
protected:
virtual void connStats(uint64_t now, Comms::Connections &statComm);
virtual std::string getConnectedHost(){return srtConn.remotehost;}
virtual std::string getConnectedBinHost(){return srtConn.getBinHost();}
virtual bool dropPushTrack(uint32_t trackId, const std::string & dropReason);
private:
HTTP::URL target;
int64_t timeStampOffset;