Fixed infinite loop in MP4 analyser when reaching end of file mid-box

This commit is contained in:
Thulinma 2023-05-22 02:51:31 +02:00
parent 7dbd60b208
commit c70fadd66f

View file

@ -18,7 +18,10 @@ bool AnalyserMP4::parsePacket(){
for (uint64_t i = mp4Buffer.size(); i < needed; ++i){ for (uint64_t i = mp4Buffer.size(); i < needed; ++i){
mp4Buffer += std::cin.get(); mp4Buffer += std::cin.get();
++curPos; ++curPos;
if (!std::cin.good()){mp4Buffer.erase(mp4Buffer.size() - 1, 1);} if (!std::cin.good()){
mp4Buffer.erase(mp4Buffer.size() - 1, 1);
break;
}
} }
} }