diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index 5cc913554fe8..52f74a8ba6e7 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6723,7 +6723,11 @@ HTMLMediaElement::SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv)
return;
}
- mPlaybackRate = ClampPlaybackRate(aPlaybackRate);
+ if (mPlaybackRate == aPlaybackRate) {
+ return;
+ }
+
+ mPlaybackRate = aPlaybackRate;
if (mPlaybackRate != 0.0 &&
(mPlaybackRate > THRESHOLD_HIGH_PLAYBACKRATE_AUDIO ||
@@ -6734,7 +6738,7 @@ HTMLMediaElement::SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv)
}
if (mDecoder) {
- mDecoder->SetPlaybackRate(mPlaybackRate);
+ mDecoder->SetPlaybackRate(ClampPlaybackRate(mPlaybackRate));
}
DispatchAsyncEvent(NS_LITERAL_STRING("ratechange"));
}