Bug 1029552 - Release HW resource when the MediaElement UnbindFromTree. r=cpearce
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -2515,25 +2515,33 @@ nsresult HTMLMediaElement::BindToTree(ns
if (aDocument) {
mAutoplayEnabled =
IsAutoplayEnabled() && (!aDocument || !aDocument->IsStaticDocument()) &&
!IsEditable();
// The preload action depends on the value of the autoplay attribute.
// It's value may have changed, so update it.
UpdatePreloadAction();
}
+ if (mDecoder) {
+ mDecoder->SetDormantIfNecessary(false);
+ }
return rv;
}
void HTMLMediaElement::UnbindFromTree(bool aDeep,
bool aNullParent)
{
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY)
Pause();
+
+ if (mDecoder) {
+ mDecoder->SetDormantIfNecessary(true);
+ }
+
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
/* static */
CanPlayStatus
HTMLMediaElement::GetCanPlay(const nsAString& aType)
{
nsContentTypeParser parser(aType);