Fix segfault in MistInRTSP when connection to buffer lost

This commit is contained in:
Thulinma 2024-07-01 13:50:13 +02:00
parent 8846c35b1b
commit 7b18307981
2 changed files with 3 additions and 3 deletions

View file

@ -326,7 +326,7 @@ std::string &RTMPStream::SendUSR(unsigned char type, unsigned int data, unsigned
/// Parses the argument Socket::Buffer into the current chunk.
/// Tries to read a whole chunk, removing data from the Buffer as it reads.
/// If a single packet contains a partial chunk, it will remove the packet and
/// call itself again. This has the effect of only causing a "true" reponse in
/// call itself again. This has the effect of only causing a "true" response in
/// the case a *whole* chunk is read, not just part of a chunk.
/// \param buffer The input to parse and update.
/// \warning This function will destroy the current data in this chunk!

View file

@ -401,11 +401,11 @@ namespace Mist{
if (idx == INVALID_TRACK_ID){
INFO_MSG("Invalid index for track number %zu", pkt.getTrackId());
}else{
if (!userSelect.count(idx)){
if (!userSelect.count(idx) || !userSelect[idx]){
WARN_MSG("Reloading track %zu, index %zu", pkt.getTrackId(), idx);
userSelect[idx].reload(streamName, idx, COMM_STATUS_ACTIVE | COMM_STATUS_SOURCE | COMM_STATUS_DONOTTRACK);
}
if (userSelect[idx].getStatus() & COMM_STATUS_REQDISCONNECT){
if (!userSelect[idx] || (userSelect[idx].getStatus() & COMM_STATUS_REQDISCONNECT)){
Util::logExitReason(ER_CLEAN_LIVE_BUFFER_REQ, "buffer requested shutdown");
tcpCon.close();
}