Fix memory leak in media streaming.

This commit is contained in:
John Preston 2020-01-21 13:50:00 +03:00
parent 2d7f6fc2e7
commit 5f5d5629f8
2 changed files with 3 additions and 0 deletions

View File

@ -309,6 +309,7 @@ void File::Context::readNextPacket() {
if (i->second.size() == kMaxQueuedPackets) { if (i->second.size() == kMaxQueuedPackets) {
processQueuedPackets(SleepPolicy::Allowed); processQueuedPackets(SleepPolicy::Allowed);
} }
Assert(i->second.size() < kMaxQueuedPackets);
} else { } else {
// Still trying to read by drain. // Still trying to read by drain.
Assert(result.is<FFmpeg::AvErrorWrap>()); Assert(result.is<FFmpeg::AvErrorWrap>());

View File

@ -396,6 +396,8 @@ bool Player::fileProcessPackets(
videoReceivedTill(till); videoReceivedTill(till);
}); });
_video->process(base::take(list)); _video->process(base::take(list));
} else {
list.clear(); // Free non-needed packets.
} }
} }
return fileReadMore(); return fileReadMore();