Bug 886219 - Force an invalidation when an async video finishes. r=nical

This commit is contained in:
Matt Woodrow 2013-10-02 16:05:34 +13:00
parent 7f8b1af70b
commit 9ad44524fe
4 changed files with 17 additions and 3 deletions

View File

@ -901,6 +901,7 @@ void MediaDecoder::PlaybackEnded()
PlaybackPositionChanged();
ChangeState(PLAY_STATE_ENDED);
InvalidateWithFlags(VideoFrameContainer::INVALIDATE_FORCE);
UpdateReadyStateForData();
if (mOwner) {
@ -1466,6 +1467,13 @@ ImageContainer* MediaDecoder::GetImageContainer()
return mVideoFrameContainer ? mVideoFrameContainer->GetImageContainer() : nullptr;
}
void MediaDecoder::InvalidateWithFlags(uint32_t aFlags)
{
if (mVideoFrameContainer) {
mVideoFrameContainer->InvalidateWithFlags(aFlags);
}
}
void MediaDecoder::Invalidate()
{
if (mVideoFrameContainer) {

View File

@ -533,6 +533,7 @@ public:
// Invalidate the frame.
void Invalidate();
void InvalidateWithFlags(uint32_t aFlags);
// Suspend any media downloads that are in progress. Called by the
// media element when it is sent to the bfcache, or when we need

View File

@ -106,11 +106,11 @@ double VideoFrameContainer::GetFrameDelay()
return mPaintDelay.ToSeconds();
}
void VideoFrameContainer::Invalidate()
void VideoFrameContainer::InvalidateWithFlags(uint32_t aFlags)
{
NS_ASSERTION(NS_IsMainThread(), "Must call on main thread");
if (!mNeedInvalidation) {
if (!mNeedInvalidation && !(aFlags & INVALIDATE_FORCE)) {
return;
}

View File

@ -55,7 +55,12 @@ public:
// but was actually painted at t+n, this returns n in seconds. Threadsafe.
double GetFrameDelay();
// Call on main thread
void Invalidate();
enum {
INVALIDATE_DEFAULT,
INVALIDATE_FORCE
};
void Invalidate() { InvalidateWithFlags(INVALIDATE_DEFAULT); }
void InvalidateWithFlags(uint32_t aFlags);
ImageContainer* GetImageContainer();
void ForgetElement() { mElement = nullptr; }