Bug 1058399 - Fix VideoData leak on osx fmp4 seek. r=cpearce

Calling Clear() on the reorder queue doesn't call delete on
the stored pointer elements. Do this explicitly to avoid leaking
decoded frames when ::Flush() is called.
This commit is contained in:
Ralph Giles 2014-08-26 14:22:00 -07:00
parent d963e4ab08
commit b50a25ed3d
2 changed files with 11 additions and 1 deletions

View File

@ -119,7 +119,8 @@ AppleVTDecoder::Flush()
if (NS_FAILED(rv)) {
LOG("AppleVTDecoder::Drain failed waiting for platform decoder.");
}
mReorderQueue.Clear();
ClearReorderedFrames();
return rv;
}
@ -221,6 +222,14 @@ AppleVTDecoder::DrainReorderedFrames()
}
}
void
AppleVTDecoder::ClearReorderedFrames()
{
while (!mReorderQueue.IsEmpty()) {
delete mReorderQueue.Pop();
}
}
// Copy and return a decoded frame.
nsresult
AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage,

View File

@ -54,6 +54,7 @@ private:
nsresult InitializeSession();
nsresult WaitForAsynchronousFrames();
void DrainReorderedFrames();
void ClearReorderedFrames();
};
} // namespace mozilla