mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 791912 - Fix crash when using libstagefright during video playback shutdown on B2G - r=cpearce
This commit is contained in:
parent
25e059e58e
commit
411020abf7
@ -66,6 +66,19 @@ void VideoFrameContainer::SetCurrentFrame(const gfxIntSize& aIntrinsicSize,
|
||||
mPaintTarget = aTargetTime;
|
||||
}
|
||||
|
||||
void VideoFrameContainer::ClearCurrentFrame()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
// See comment in SetCurrentFrame for the reasoning behind
|
||||
// using a kungFuDeathGrip here.
|
||||
nsRefPtr<Image> kungFuDeathGrip;
|
||||
kungFuDeathGrip = mImageContainer->LockCurrentImage();
|
||||
mImageContainer->UnlockCurrentImage();
|
||||
|
||||
mImageContainer->SetCurrentImage(nullptr);
|
||||
}
|
||||
|
||||
ImageContainer* VideoFrameContainer::GetImageContainer() {
|
||||
return mImageContainer;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
// Call on any thread
|
||||
void SetCurrentFrame(const gfxIntSize& aIntrinsicSize, Image* aImage,
|
||||
TimeStamp aTargetTime);
|
||||
void ClearCurrentFrame();
|
||||
// Time in seconds by which the last painted video frame was late by.
|
||||
// E.g. if the last painted frame should have been painted at time t,
|
||||
// but was actually painted at t+n, this returns n in seconds. Threadsafe.
|
||||
|
@ -98,6 +98,13 @@ nsresult nsMediaOmxReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
// Resets all state related to decoding, emptying all buffers etc.
|
||||
nsresult nsMediaOmxReader::ResetDecode()
|
||||
{
|
||||
nsBuiltinDecoderReader::ResetDecode();
|
||||
|
||||
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
|
||||
if (container) {
|
||||
container->ClearCurrentFrame();
|
||||
}
|
||||
|
||||
if (mLastVideoFrame) {
|
||||
delete mLastVideoFrame;
|
||||
mLastVideoFrame = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user