Prevent crash when applying limiter to a non-existing main track

This commit is contained in:
Thulinma 2024-06-23 18:17:21 +02:00
parent 90b16439cd
commit f2bb7ffa94

View file

@ -1242,13 +1242,15 @@ namespace Mist{
// apply a limiter to the stream to make it appear like a VoD asset // apply a limiter to the stream to make it appear like a VoD asset
if (targetParams.count("stop") || !M.getLive()){ if (targetParams.count("stop") || !M.getLive()){
size_t mainTrack = getMainSelectedTrack(); size_t mainTrack = getMainSelectedTrack();
uint64_t stopPos = M.getLastms(mainTrack); if (mainTrack != INVALID_TRACK_ID){
if (targetParams.count("stop")){stopPos = atoll(targetParams["stop"].c_str());} uint64_t stopPos = M.getLastms(mainTrack);
if (!M.getLive() || stopPos <= M.getLastms(mainTrack)){ if (targetParams.count("stop")){stopPos = atoll(targetParams["stop"].c_str());}
meta.applyLimiter(seekPos, stopPos); if (!M.getLive() || stopPos <= M.getLastms(mainTrack)){
}else{ meta.applyLimiter(seekPos, stopPos);
// End point past end of track? Don't limit the end point. }else{
meta.applyLimiter(seekPos, 0xFFFFFFFFFFFFFFFFull); // End point past end of track? Don't limit the end point.
meta.applyLimiter(seekPos, 0xFFFFFFFFFFFFFFFFull);
}
} }
}else{ }else{
// No stop point, only apply limiter if a start point is set, and never limit the end point. // No stop point, only apply limiter if a start point is set, and never limit the end point.