Bug 1314884. Part 7 - remove SeekResolveValue::mEventVisibility for we always assume MediaDecoderEventVisibility::Observable in P6.
MozReview-Commit-ID: 8jUaFPkQQxA
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -1126,24 +1126,22 @@ MediaDecoder::OnSeekResolved(SeekResolve
fireEnded = aVal.mAtEnd;
if (aVal.mAtEnd) {
ChangeState(PLAY_STATE_ENDED);
}
mLogicallySeeking = false;
}
// Ensure logical position is updated after seek.
- UpdateLogicalPositionInternal(aVal.mEventVisibility);
+ UpdateLogicalPositionInternal();
- if (aVal.mEventVisibility != MediaDecoderEventVisibility::Suppressed) {
- mOwner->SeekCompleted();
- AsyncResolveSeekDOMPromiseIfExists();
- if (fireEnded) {
- mOwner->PlaybackEnded();
- }
+ mOwner->SeekCompleted();
+ AsyncResolveSeekDOMPromiseIfExists();
+ if (fireEnded) {
+ mOwner->PlaybackEnded();
}
}
void
MediaDecoder::OnSeekRejected()
{
MOZ_ASSERT(NS_IsMainThread());
mSeekRequest.Complete();
@@ -1175,17 +1173,17 @@ MediaDecoder::ChangeState(PlayState aSta
if (mPlayState == PLAY_STATE_PLAYING) {
ConstructMediaTracks();
} else if (IsEnded()) {
RemoveMediaTracks();
}
}
void
-MediaDecoder::UpdateLogicalPositionInternal(MediaDecoderEventVisibility aEventVisibility)
+MediaDecoder::UpdateLogicalPositionInternal()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown());
double currentPosition = static_cast<double>(CurrentPosition()) / static_cast<double>(USECS_PER_S);
if (mPlayState == PLAY_STATE_ENDED) {
currentPosition = std::max(currentPosition, mDuration);
}
@@ -1193,18 +1191,17 @@ MediaDecoder::UpdateLogicalPositionInter
mLogicalPosition = currentPosition;
// Invalidate the frame so any video data is displayed.
// Do this before the timeupdate event so that if that
// event runs JavaScript that queries the media size, the
// frame has reflowed and the size updated beforehand.
Invalidate();
- if (logicalPositionChanged &&
- aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
+ if (logicalPositionChanged) {
FireTimeUpdate();
}
}
void
MediaDecoder::DurationChanged()
{
MOZ_ASSERT(NS_IsMainThread());
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -54,20 +54,17 @@ enum class MediaEventType : int8_t;
#ifdef GetCurrentTime
#undef GetCurrentTime
#endif
class MediaDecoder : public AbstractMediaDecoder
{
public:
struct SeekResolveValue {
- SeekResolveValue(bool aAtEnd, MediaDecoderEventVisibility aEventVisibility)
- : mAtEnd(aAtEnd), mEventVisibility(aEventVisibility) {}
bool mAtEnd;
- MediaDecoderEventVisibility mEventVisibility;
};
// Used to register with MediaResource to receive notifications which will
// be forwarded to MediaDecoder.
class ResourceCallback : public MediaResourceCallback {
// Throttle calls to MediaDecoder::NotifyDataArrived()
// to be at most once per 500ms.
static const uint32_t sDelay = 500;
@@ -397,26 +394,26 @@ private:
// seeking to prevent wild changes to the progress notification.
MOZ_ASSERT(NS_IsMainThread());
mIgnoreProgressData = mLogicallySeeking;
}
// Seeking has started. Inform the element on the main thread.
void SeekingStarted();
- void UpdateLogicalPositionInternal(MediaDecoderEventVisibility aEventVisibility);
+ void UpdateLogicalPositionInternal();
void UpdateLogicalPosition()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown());
// Per spec, offical position remains stable during pause and seek.
if (mPlayState == PLAY_STATE_PAUSED || IsSeeking()) {
return;
}
- UpdateLogicalPositionInternal(MediaDecoderEventVisibility::Observable);
+ UpdateLogicalPositionInternal();
}
// Find the end of the cached data starting at the current decoder
// position.
int64_t GetDownloadPosition();
// Notifies the element that decoding has failed.
void DecodeError(const MediaResult& aError);
--- a/dom/media/SeekJob.cpp
+++ b/dom/media/SeekJob.cpp
@@ -36,17 +36,18 @@ SeekJob& SeekJob::operator=(SeekJob&& aO
bool SeekJob::Exists() const
{
MOZ_ASSERT(mTarget.IsValid() == !mPromise.IsEmpty());
return mTarget.IsValid();
}
void SeekJob::Resolve(bool aAtEnd, const char* aCallSite)
{
- MediaDecoder::SeekResolveValue val(aAtEnd, MediaDecoderEventVisibility::Observable);
+ MediaDecoder::SeekResolveValue val;
+ val.mAtEnd = aAtEnd;
mPromise.Resolve(val, aCallSite);
mTarget.Reset();
}
void SeekJob::RejectIfExists(const char* aCallSite)
{
mTarget.Reset();
mPromise.RejectIfExists(true, aCallSite);