mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 4 changesets (bug 1128357) for causing intermittent B2G mochitest asserts.
Backed out changeset da4499b52105 (bug 1128357) Backed out changeset fa440c623c4d (bug 1128357) Backed out changeset 36b8feee431e (bug 1128357) Backed out changeset aaa85558f413 (bug 1128357) CLOSED TREE
This commit is contained in:
parent
679f666774
commit
ccc4d17f94
@ -573,7 +573,7 @@ HTMLMediaElement::Ended()
|
||||
}
|
||||
|
||||
if (mDecoder) {
|
||||
return mDecoder->IsEndedOrShutdown();
|
||||
return mDecoder->IsEnded();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -2199,7 +2199,7 @@ HTMLMediaElement::Play(ErrorResult& aRv)
|
||||
// Even if we just did Load() or ResumeLoad(), we could already have a decoder
|
||||
// here if we managed to clone an existing decoder.
|
||||
if (mDecoder) {
|
||||
if (mDecoder->IsEndedOrShutdown()) {
|
||||
if (mDecoder->IsEnded()) {
|
||||
SetCurrentTime(0);
|
||||
}
|
||||
if (!mPausedForInactiveDocumentOrChannel) {
|
||||
@ -3177,7 +3177,7 @@ void HTMLMediaElement::PlaybackEnded()
|
||||
// We changed state which can affect AddRemoveSelfReference
|
||||
AddRemoveSelfReference();
|
||||
|
||||
NS_ASSERTION(!mDecoder || mDecoder->IsEndedOrShutdown(),
|
||||
NS_ASSERTION(!mDecoder || mDecoder->IsEnded(),
|
||||
"Decoder fired ended, but not in ended state");
|
||||
|
||||
// Discard all output streams that have finished now.
|
||||
@ -3414,7 +3414,7 @@ void HTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatu
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEndedOrShutdown()) {
|
||||
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEnded()) {
|
||||
// The decoder has signaled that the download has been suspended by the
|
||||
// media cache. So move readyState into HAVE_ENOUGH_DATA, in case there's
|
||||
// script waiting for a "canplaythrough" event; without this forced
|
||||
@ -3697,7 +3697,7 @@ bool HTMLMediaElement::IsPlaybackEnded() const
|
||||
// the current playback position is equal to the effective end of the media resource.
|
||||
// See bug 449157.
|
||||
return mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA &&
|
||||
mDecoder ? mDecoder->IsEndedOrShutdown() : false;
|
||||
mDecoder ? mDecoder->IsEnded() : false;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPrincipal> HTMLMediaElement::GetCurrentPrincipal()
|
||||
@ -3771,7 +3771,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
|
||||
#endif
|
||||
if (mDecoder) {
|
||||
mDecoder->Resume(false);
|
||||
if (!mPaused && !mDecoder->IsEndedOrShutdown()) {
|
||||
if (!mPaused && !mDecoder->IsEnded()) {
|
||||
mDecoder->Play();
|
||||
}
|
||||
} else if (mSrcStream) {
|
||||
@ -3832,7 +3832,7 @@ void HTMLMediaElement::AddRemoveSelfReference()
|
||||
bool needSelfReference = !mShuttingDown &&
|
||||
ownerDoc->IsActive() &&
|
||||
(mDelayingLoadEvent ||
|
||||
(!mPaused && mDecoder && !mDecoder->IsEndedOrShutdown()) ||
|
||||
(!mPaused && mDecoder && !mDecoder->IsEnded()) ||
|
||||
(!mPaused && mSrcStream && !mSrcStream->IsFinished()) ||
|
||||
(mDecoder && mDecoder->IsSeeking()) ||
|
||||
CanActivateAutoplay() ||
|
||||
|
@ -35,11 +35,6 @@ static inline bool IsCurrentThread(nsIThread* aThread) {
|
||||
return NS_GetCurrentThread() == aThread;
|
||||
}
|
||||
|
||||
enum class MediaDecoderEventVisibility : int8_t {
|
||||
Observable,
|
||||
Suppressed
|
||||
};
|
||||
|
||||
/**
|
||||
* The AbstractMediaDecoder class describes the public interface for a media decoder
|
||||
* and is used by the MediaReader classes.
|
||||
@ -95,9 +90,9 @@ public:
|
||||
// Return true if the transport layer supports seeking.
|
||||
virtual bool IsMediaSeekable() = 0;
|
||||
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, MediaDecoderEventVisibility aEventVisibility) = 0;
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, bool aRestoredFromDormant) = 0;
|
||||
virtual void QueueMetadata(int64_t aTime, nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags) = 0;
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, MediaDecoderEventVisibility aEventVisibility) = 0;
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, bool aRestoredFromDormant) = 0;
|
||||
|
||||
virtual void RemoveMediaTracks() = 0;
|
||||
|
||||
@ -171,17 +166,17 @@ protected:
|
||||
MetadataContainer(AbstractMediaDecoder* aDecoder,
|
||||
nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility)
|
||||
bool aRestoredFromDormant)
|
||||
: mDecoder(aDecoder),
|
||||
mInfo(aInfo),
|
||||
mTags(aTags),
|
||||
mEventVisibility(aEventVisibility)
|
||||
mRestoredFromDormant(aRestoredFromDormant)
|
||||
{}
|
||||
|
||||
nsRefPtr<AbstractMediaDecoder> mDecoder;
|
||||
nsAutoPtr<MediaInfo> mInfo;
|
||||
nsAutoPtr<MetadataTags> mTags;
|
||||
MediaDecoderEventVisibility mEventVisibility;
|
||||
bool mRestoredFromDormant;
|
||||
};
|
||||
|
||||
class MetadataEventRunner : public nsRunnable, private MetadataContainer
|
||||
@ -190,13 +185,13 @@ public:
|
||||
MetadataEventRunner(AbstractMediaDecoder* aDecoder,
|
||||
nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable)
|
||||
: MetadataContainer(aDecoder, aInfo, aTags, aEventVisibility)
|
||||
bool aRestoredFromDormant = false)
|
||||
: MetadataContainer(aDecoder, aInfo, aTags, aRestoredFromDormant)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
mDecoder->MetadataLoaded(mInfo, mTags, mEventVisibility);
|
||||
mDecoder->MetadataLoaded(mInfo, mTags, mRestoredFromDormant);
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
@ -206,13 +201,13 @@ class FirstFrameLoadedEventRunner : public nsRunnable, private MetadataContainer
|
||||
public:
|
||||
FirstFrameLoadedEventRunner(AbstractMediaDecoder* aDecoder,
|
||||
nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable)
|
||||
: MetadataContainer(aDecoder, aInfo, nsAutoPtr<MetadataTags>(nullptr), aEventVisibility)
|
||||
bool aRestoredFromDormant = false)
|
||||
: MetadataContainer(aDecoder, aInfo, nsAutoPtr<MetadataTags>(nullptr), aRestoredFromDormant)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
mDecoder->FirstFrameLoaded(mInfo, mEventVisibility);
|
||||
mDecoder->FirstFrameLoaded(mInfo, mRestoredFromDormant);
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
@ -223,16 +218,16 @@ public:
|
||||
MetadataUpdatedEventRunner(AbstractMediaDecoder* aDecoder,
|
||||
nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable)
|
||||
: MetadataContainer(aDecoder, aInfo, aTags, aEventVisibility)
|
||||
bool aRestoredFromDormant = false)
|
||||
: MetadataContainer(aDecoder, aInfo, aTags, aRestoredFromDormant)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
nsAutoPtr<MediaInfo> info(new MediaInfo());
|
||||
*info = *mInfo;
|
||||
mDecoder->MetadataLoaded(info, mTags, mEventVisibility);
|
||||
mDecoder->FirstFrameLoaded(mInfo, mEventVisibility);
|
||||
mDecoder->MetadataLoaded(info, mTags, mRestoredFromDormant);
|
||||
mDecoder->FirstFrameLoaded(mInfo, mRestoredFromDormant);
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
@ -150,11 +150,6 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
|
||||
return;
|
||||
}
|
||||
|
||||
DECODER_LOG("UpdateDormantState aTimeout=%d aActivity=%d mIsDormant=%d "
|
||||
"ownerActive=%d ownerHidden=%d mIsHeuristicDormant=%d mPlayState=%s",
|
||||
aDormantTimeout, aActivity, mIsDormant, mOwner->IsActive(),
|
||||
mOwner->IsHidden(), mIsHeuristicDormant, PlayStateStr());
|
||||
|
||||
bool prevDormant = mIsDormant;
|
||||
mIsDormant = false;
|
||||
if (!mOwner->IsActive()) {
|
||||
@ -170,7 +165,7 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
|
||||
mIsHeuristicDormant = false;
|
||||
if (mIsHeuristicDormantSupported && mOwner->IsHidden()) {
|
||||
if (aDormantTimeout && !aActivity &&
|
||||
(mPlayState == PLAY_STATE_PAUSED || IsEnded())) {
|
||||
(mPlayState == PLAY_STATE_PAUSED || mPlayState == PLAY_STATE_ENDED)) {
|
||||
// Enable heuristic dormant
|
||||
mIsHeuristicDormant = true;
|
||||
} else if(prevHeuristicDormant && !aActivity) {
|
||||
@ -189,30 +184,19 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
|
||||
}
|
||||
|
||||
if (mIsDormant) {
|
||||
DECODER_LOG("UpdateDormantState() entering DORMANT state");
|
||||
// enter dormant state
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethodWithArg<bool>(
|
||||
mDecoderStateMachine,
|
||||
&MediaDecoderStateMachine::SetDormant,
|
||||
true);
|
||||
mDecoderStateMachine->GetStateMachineThread()->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
mDecoderStateMachine->SetDormant(true);
|
||||
|
||||
int64_t timeUsecs = 0;
|
||||
SecondsToUsecs(mCurrentTime, timeUsecs);
|
||||
mRequestedSeekTarget = SeekTarget(timeUsecs, SeekTarget::Accurate);
|
||||
|
||||
if (IsEnded()) {
|
||||
mWasEndedWhenEnteredDormant = true;
|
||||
}
|
||||
mNextState = mPlayState;
|
||||
ChangeState(PLAY_STATE_LOADING);
|
||||
} else {
|
||||
DECODER_LOG("UpdateDormantState() leaving DORMANT state");
|
||||
// exit dormant state
|
||||
// trigger to state machine.
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethodWithArg<bool>(
|
||||
mDecoderStateMachine,
|
||||
&MediaDecoderStateMachine::SetDormant,
|
||||
false);
|
||||
mDecoderStateMachine->GetStateMachineThread()->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
mDecoderStateMachine->SetDormant(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,7 +220,7 @@ void MediaDecoder::StartDormantTimer()
|
||||
!mOwner ||
|
||||
!mOwner->IsHidden() ||
|
||||
(mPlayState != PLAY_STATE_PAUSED &&
|
||||
!IsEnded()))
|
||||
mPlayState != PLAY_STATE_ENDED))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -263,7 +247,7 @@ void MediaDecoder::Pause()
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
if (mPlayState == PLAY_STATE_LOADING ||
|
||||
mPlayState == PLAY_STATE_SEEKING ||
|
||||
IsEnded()) {
|
||||
mPlayState == PLAY_STATE_ENDED) {
|
||||
mNextState = PLAY_STATE_PAUSED;
|
||||
return;
|
||||
}
|
||||
@ -596,7 +580,6 @@ MediaDecoder::MediaDecoder() :
|
||||
mMinimizePreroll(false),
|
||||
mMediaTracksConstructed(false),
|
||||
mIsDormant(false),
|
||||
mWasEndedWhenEnteredDormant(false),
|
||||
mIsHeuristicDormantSupported(
|
||||
Preferences::GetBool("media.decoder.heuristic.dormant.enabled", false)),
|
||||
mHeuristicDormantTimeout(
|
||||
@ -765,12 +748,13 @@ nsresult MediaDecoder::Play()
|
||||
}
|
||||
nsresult res = ScheduleStateMachineThread();
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
if (IsEnded()) {
|
||||
return Seek(0, SeekTarget::PrevSyncPoint);
|
||||
} else if (mPlayState == PLAY_STATE_LOADING || mPlayState == PLAY_STATE_SEEKING) {
|
||||
if (mPlayState == PLAY_STATE_LOADING || mPlayState == PLAY_STATE_SEEKING) {
|
||||
mNextState = PLAY_STATE_PLAYING;
|
||||
return NS_OK;
|
||||
}
|
||||
if (mPlayState == PLAY_STATE_ENDED) {
|
||||
return Seek(0, SeekTarget::PrevSyncPoint);
|
||||
}
|
||||
|
||||
ChangeState(PLAY_STATE_PLAYING);
|
||||
return NS_OK;
|
||||
@ -790,7 +774,6 @@ nsresult MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType)
|
||||
|
||||
mRequestedSeekTarget = SeekTarget(timeUsecs, aSeekType);
|
||||
mCurrentTime = aTime;
|
||||
mWasEndedWhenEnteredDormant = false;
|
||||
|
||||
// If we are already in the seeking state, the new seek overrides the old one.
|
||||
if (mPlayState != PLAY_STATE_LOADING) {
|
||||
@ -855,7 +838,7 @@ MediaDecoder::IsExpectingMoreData()
|
||||
|
||||
void MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility)
|
||||
bool aRestoredFromDormant)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -885,29 +868,14 @@ void MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
// Make sure the element and the frame (if any) are told about
|
||||
// our new size.
|
||||
Invalidate();
|
||||
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
|
||||
if (!aRestoredFromDormant) {
|
||||
mOwner->MetadataLoaded(mInfo, nsAutoPtr<const MetadataTags>(aTags.forget()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
MediaDecoder::PlayStateStr()
|
||||
{
|
||||
switch (mPlayState) {
|
||||
case PLAY_STATE_START: return "PLAY_STATE_START";
|
||||
case PLAY_STATE_LOADING: return "PLAY_STATE_LOADING";
|
||||
case PLAY_STATE_PAUSED: return "PLAY_STATE_PAUSED";
|
||||
case PLAY_STATE_PLAYING: return "PLAY_STATE_PLAYING";
|
||||
case PLAY_STATE_SEEKING: return "PLAY_STATE_SEEKING";
|
||||
case PLAY_STATE_ENDED: return "PLAY_STATE_ENDED";
|
||||
case PLAY_STATE_SHUTDOWN: return "PLAY_STATE_SHUTDOWN";
|
||||
default: return "INVALID_PLAY_STATE";
|
||||
}
|
||||
}
|
||||
|
||||
void MediaDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility)
|
||||
bool aRestoredFromDormant)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -915,17 +883,15 @@ void MediaDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!mIsDormant, "Expected not to be dormant here");
|
||||
|
||||
DECODER_LOG("FirstFrameLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d mPlayState=%s mIsDormant=%d",
|
||||
DECODER_LOG("FirstFrameLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d",
|
||||
aInfo->mAudio.mChannels, aInfo->mAudio.mRate,
|
||||
aInfo->HasAudio(), aInfo->HasVideo(), PlayStateStr(), mIsDormant);
|
||||
aInfo->HasAudio(), aInfo->HasVideo());
|
||||
|
||||
mInfo = aInfo.forget();
|
||||
|
||||
if (mOwner) {
|
||||
Invalidate();
|
||||
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
|
||||
if (!aRestoredFromDormant) {
|
||||
mOwner->FirstFrameLoaded();
|
||||
}
|
||||
}
|
||||
@ -1011,16 +977,10 @@ bool MediaDecoder::IsSeeking() const
|
||||
(mPlayState == PLAY_STATE_LOADING && mRequestedSeekTarget.IsValid()));
|
||||
}
|
||||
|
||||
bool MediaDecoder::IsEndedOrShutdown() const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return IsEnded() || mPlayState == PLAY_STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
bool MediaDecoder::IsEnded() const
|
||||
{
|
||||
return mPlayState == PLAY_STATE_ENDED ||
|
||||
(mWasEndedWhenEnteredDormant && (mPlayState != PLAY_STATE_SHUTDOWN));
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mPlayState == PLAY_STATE_ENDED || mPlayState == PLAY_STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
void MediaDecoder::PlaybackEnded()
|
||||
@ -1203,15 +1163,14 @@ void MediaDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
|
||||
void MediaDecoder::UpdateReadyStateForData()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mOwner || mShuttingDown || !mDecoderStateMachine) {
|
||||
if (!mOwner || mShuttingDown || !mDecoderStateMachine)
|
||||
return;
|
||||
}
|
||||
MediaDecoderOwner::NextFrameStatus frameStatus =
|
||||
mDecoderStateMachine->GetNextFrameStatus();
|
||||
mOwner->UpdateReadyStateForData(frameStatus);
|
||||
}
|
||||
|
||||
void MediaDecoder::SeekingStopped(MediaDecoderEventVisibility aEventVisibility)
|
||||
void MediaDecoder::SeekingStopped()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1229,17 +1188,15 @@ void MediaDecoder::SeekingStopped(MediaDecoderEventVisibility aEventVisibility)
|
||||
seekWasAborted = true;
|
||||
} else {
|
||||
UnpinForSeek();
|
||||
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
|
||||
ChangeState(mNextState);
|
||||
}
|
||||
ChangeState(mNextState);
|
||||
}
|
||||
}
|
||||
|
||||
PlaybackPositionChanged(aEventVisibility);
|
||||
PlaybackPositionChanged();
|
||||
|
||||
if (mOwner) {
|
||||
UpdateReadyStateForData();
|
||||
if (!seekWasAborted && (aEventVisibility != MediaDecoderEventVisibility::Suppressed)) {
|
||||
if (!seekWasAborted) {
|
||||
mOwner->SeekCompleted();
|
||||
}
|
||||
}
|
||||
@ -1247,7 +1204,7 @@ void MediaDecoder::SeekingStopped(MediaDecoderEventVisibility aEventVisibility)
|
||||
|
||||
// This is called when seeking stopped *and* we're at the end of the
|
||||
// media.
|
||||
void MediaDecoder::SeekingStoppedAtEnd(MediaDecoderEventVisibility aEventVisibility)
|
||||
void MediaDecoder::SeekingStoppedAtEnd()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1271,11 +1228,11 @@ void MediaDecoder::SeekingStoppedAtEnd(MediaDecoderEventVisibility aEventVisibil
|
||||
}
|
||||
}
|
||||
|
||||
PlaybackPositionChanged(aEventVisibility);
|
||||
PlaybackPositionChanged();
|
||||
|
||||
if (mOwner) {
|
||||
UpdateReadyStateForData();
|
||||
if (!seekWasAborted && (aEventVisibility != MediaDecoderEventVisibility::Suppressed)) {
|
||||
if (!seekWasAborted) {
|
||||
mOwner->SeekCompleted();
|
||||
if (fireEnded) {
|
||||
mOwner->PlaybackEnded();
|
||||
@ -1284,7 +1241,7 @@ void MediaDecoder::SeekingStoppedAtEnd(MediaDecoderEventVisibility aEventVisibil
|
||||
}
|
||||
}
|
||||
|
||||
void MediaDecoder::SeekingStarted(MediaDecoderEventVisibility aEventVisibility)
|
||||
void MediaDecoder::SeekingStarted()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown)
|
||||
@ -1292,9 +1249,7 @@ void MediaDecoder::SeekingStarted(MediaDecoderEventVisibility aEventVisibility)
|
||||
|
||||
if (mOwner) {
|
||||
UpdateReadyStateForData();
|
||||
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
|
||||
mOwner->SeekStarted();
|
||||
}
|
||||
mOwner->SeekStarted();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1326,7 +1281,7 @@ void MediaDecoder::ChangeState(PlayState aState)
|
||||
|
||||
if (mPlayState == PLAY_STATE_PLAYING) {
|
||||
ConstructMediaTracks();
|
||||
} else if (IsEnded()) {
|
||||
} else if (mPlayState == PLAY_STATE_ENDED) {
|
||||
RemoveMediaTracks();
|
||||
}
|
||||
|
||||
@ -1362,7 +1317,7 @@ void MediaDecoder::ApplyStateToStateMachine(PlayState aState)
|
||||
}
|
||||
}
|
||||
|
||||
void MediaDecoder::PlaybackPositionChanged(MediaDecoderEventVisibility aEventVisibility)
|
||||
void MediaDecoder::PlaybackPositionChanged()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown)
|
||||
@ -1398,9 +1353,7 @@ void MediaDecoder::PlaybackPositionChanged(MediaDecoderEventVisibility aEventVis
|
||||
// frame has reflowed and the size updated beforehand.
|
||||
Invalidate();
|
||||
|
||||
if (mOwner &&
|
||||
(aEventVisibility != MediaDecoderEventVisibility::Suppressed) &&
|
||||
lastTime != mCurrentTime) {
|
||||
if (mOwner && lastTime != mCurrentTime) {
|
||||
FireTimeUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -235,22 +235,16 @@ struct SeekTarget {
|
||||
SeekTarget()
|
||||
: mTime(-1.0)
|
||||
, mType(SeekTarget::Invalid)
|
||||
, mEventVisibility(MediaDecoderEventVisibility::Observable)
|
||||
{
|
||||
}
|
||||
SeekTarget(int64_t aTimeUsecs,
|
||||
Type aType,
|
||||
MediaDecoderEventVisibility aEventVisibility =
|
||||
MediaDecoderEventVisibility::Observable)
|
||||
SeekTarget(int64_t aTimeUsecs, Type aType)
|
||||
: mTime(aTimeUsecs)
|
||||
, mType(aType)
|
||||
, mEventVisibility(aEventVisibility)
|
||||
{
|
||||
}
|
||||
SeekTarget(const SeekTarget& aOther)
|
||||
: mTime(aOther.mTime)
|
||||
, mType(aOther.mType)
|
||||
, mEventVisibility(aOther.mEventVisibility)
|
||||
{
|
||||
}
|
||||
bool IsValid() const {
|
||||
@ -266,7 +260,6 @@ struct SeekTarget {
|
||||
// "Fast" seeks to the seek point preceeding mTime, whereas
|
||||
// "Accurate" seeks as close as possible to mTime.
|
||||
Type mType;
|
||||
MediaDecoderEventVisibility mEventVisibility;
|
||||
};
|
||||
|
||||
class MediaDecoder : public nsIObserver,
|
||||
@ -583,10 +576,9 @@ public:
|
||||
// Call on the main thread only.
|
||||
virtual bool IsSeeking() const;
|
||||
|
||||
// Return true if the decoder has reached the end of playback or the decoder
|
||||
// has shutdown.
|
||||
// Return true if the decoder has reached the end of playback.
|
||||
// Call on the main thread only.
|
||||
virtual bool IsEndedOrShutdown() const;
|
||||
virtual bool IsEnded() const;
|
||||
|
||||
// Set the duration of the media resource in units of seconds.
|
||||
// This is called via a channel listener if it can pick up the duration
|
||||
@ -774,12 +766,12 @@ public:
|
||||
// state machine. Call on the main thread only.
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility) MOZ_OVERRIDE;
|
||||
bool aRestoredFromDormant) MOZ_OVERRIDE;
|
||||
|
||||
// Called when the first audio and/or video from the media file has been loaded
|
||||
// by the state machine. Call on the main thread only.
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility) MOZ_OVERRIDE;
|
||||
bool aRestoredFromDormant) MOZ_OVERRIDE;
|
||||
|
||||
// Called from MetadataLoaded(). Creates audio tracks and adds them to its
|
||||
// owner's audio track list, and implies to video tracks respectively.
|
||||
@ -803,20 +795,20 @@ public:
|
||||
|
||||
// Seeking has stopped. Inform the element on the main
|
||||
// thread.
|
||||
void SeekingStopped(MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable);
|
||||
void SeekingStopped();
|
||||
|
||||
// Seeking has stopped at the end of the resource. Inform the element on the main
|
||||
// thread.
|
||||
void SeekingStoppedAtEnd(MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable);
|
||||
void SeekingStoppedAtEnd();
|
||||
|
||||
// Seeking has started. Inform the element on the main
|
||||
// thread.
|
||||
void SeekingStarted(MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable);
|
||||
void SeekingStarted();
|
||||
|
||||
// Called when the backend has changed the current playback
|
||||
// position. It dispatches a timeupdate event and invalidates the frame.
|
||||
// This must be called on the main thread only.
|
||||
virtual void PlaybackPositionChanged(MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable);
|
||||
virtual void PlaybackPositionChanged();
|
||||
|
||||
// Calls mElement->UpdateReadyStateForData, telling it whether we have
|
||||
// data for the next frame and if we're buffering. Main thread only.
|
||||
@ -1036,9 +1028,6 @@ protected:
|
||||
// Cancel a timer for heuristic dormant.
|
||||
void CancelDormantTimer();
|
||||
|
||||
// Return true if the decoder has reached the end of playback
|
||||
bool IsEnded() const;
|
||||
|
||||
/******
|
||||
* The following members should be accessed with the decoder lock held.
|
||||
******/
|
||||
@ -1156,8 +1145,6 @@ protected:
|
||||
// Ensures our media stream has been unpinned.
|
||||
void UnpinForSeek();
|
||||
|
||||
const char* PlayStateStr();
|
||||
|
||||
// This should only ever be accessed from the main thread.
|
||||
// It is set in Init and cleared in Shutdown when the element goes away.
|
||||
// The decoder does not add a reference the element.
|
||||
@ -1207,12 +1194,6 @@ protected:
|
||||
// True if MediaDecoder is in dormant state.
|
||||
bool mIsDormant;
|
||||
|
||||
// True if MediaDecoder was PLAY_STATE_ENDED state, when entering to dormant.
|
||||
// When MediaCodec is in dormant during PLAY_STATE_ENDED state, PlayState
|
||||
// becomes different from PLAY_STATE_ENDED. But the MediaDecoder need to act
|
||||
// as in PLAY_STATE_ENDED state to MediaDecoderOwner.
|
||||
bool mWasEndedWhenEnteredDormant;
|
||||
|
||||
// True if heuristic dormant is supported.
|
||||
const bool mIsHeuristicDormantSupported;
|
||||
|
||||
|
@ -1245,10 +1245,7 @@ void MediaDecoderStateMachine::UpdatePlaybackPosition(int64_t aTime)
|
||||
if (!mPositionChangeQueued || fragmentEnded) {
|
||||
mPositionChangeQueued = true;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mDecoder,
|
||||
&MediaDecoder::PlaybackPositionChanged,
|
||||
MediaDecoderEventVisibility::Observable);
|
||||
NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackPositionChanged);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
@ -1457,12 +1454,8 @@ bool MediaDecoderStateMachine::IsDormantNeeded()
|
||||
|
||||
void MediaDecoderStateMachine::SetDormant(bool aDormant)
|
||||
{
|
||||
MOZ_ASSERT(OnStateMachineThread(), "Should be on state machine thread.");
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (mState == DECODER_STATE_SHUTDOWN) {
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (!mReader) {
|
||||
return;
|
||||
@ -1471,22 +1464,12 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant)
|
||||
DECODER_LOG("SetDormant=%d", aDormant);
|
||||
|
||||
if (aDormant) {
|
||||
if (mState == DECODER_STATE_SEEKING) {
|
||||
if (mQueuedSeekTarget.IsValid()) {
|
||||
// Keep latest seek target
|
||||
} else if (mSeekTarget.IsValid()) {
|
||||
if (mState == DECODER_STATE_SEEKING && !mQueuedSeekTarget.IsValid()) {
|
||||
if (mSeekTarget.IsValid()) {
|
||||
mQueuedSeekTarget = mSeekTarget;
|
||||
} else if (mCurrentSeekTarget.IsValid()) {
|
||||
mQueuedSeekTarget = mCurrentSeekTarget;
|
||||
} else {
|
||||
mQueuedSeekTarget = SeekTarget(mCurrentFrameTime,
|
||||
SeekTarget::Accurate,
|
||||
MediaDecoderEventVisibility::Suppressed);
|
||||
}
|
||||
} else {
|
||||
mQueuedSeekTarget = SeekTarget(mCurrentFrameTime,
|
||||
SeekTarget::Accurate,
|
||||
MediaDecoderEventVisibility::Suppressed);
|
||||
}
|
||||
mSeekTarget.Reset();
|
||||
mCurrentSeekTarget.Reset();
|
||||
@ -1592,11 +1575,6 @@ void MediaDecoderStateMachine::PlayInternal()
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
}
|
||||
|
||||
if (mDecodingFrozenAtStateDecoding) {
|
||||
mDecodingFrozenAtStateDecoding = false;
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
}
|
||||
|
||||
// Some state transitions still happen synchronously on the main thread. So
|
||||
// if the main thread invokes Play() and then Seek(), the seek will initiate
|
||||
// synchronously on the main thread, and the asynchronous PlayInternal task
|
||||
@ -1618,6 +1596,11 @@ void MediaDecoderStateMachine::PlayInternal()
|
||||
StartDecoding();
|
||||
}
|
||||
|
||||
if (mDecodingFrozenAtStateDecoding) {
|
||||
mDecodingFrozenAtStateDecoding = false;
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
}
|
||||
|
||||
ScheduleStateMachine();
|
||||
}
|
||||
|
||||
@ -1757,7 +1740,7 @@ MediaDecoderStateMachine::StartSeek(const SeekTarget& aTarget)
|
||||
seekTime = std::max(mStartTime, seekTime);
|
||||
NS_ASSERTION(seekTime >= mStartTime && seekTime <= end,
|
||||
"Can only seek in range [0,duration]");
|
||||
mSeekTarget = SeekTarget(seekTime, aTarget.mType, aTarget.mEventVisibility);
|
||||
mSeekTarget = SeekTarget(seekTime, aTarget.mType);
|
||||
|
||||
DECODER_LOG("Changed state to SEEKING (to %lld)", mSeekTarget.mTime);
|
||||
SetState(DECODER_STATE_SEEKING);
|
||||
@ -2274,11 +2257,8 @@ MediaDecoderStateMachine::EnqueueLoadedMetadataEvent()
|
||||
{
|
||||
nsAutoPtr<MediaInfo> info(new MediaInfo());
|
||||
*info = mInfo;
|
||||
MediaDecoderEventVisibility visibility = mSentLoadedMetadataEvent?
|
||||
MediaDecoderEventVisibility::Suppressed :
|
||||
MediaDecoderEventVisibility::Observable;
|
||||
nsCOMPtr<nsIRunnable> metadataLoadedEvent =
|
||||
new MetadataEventRunner(mDecoder, info, mMetadataTags, visibility);
|
||||
new MetadataEventRunner(mDecoder, info, mMetadataTags, mSentLoadedMetadataEvent);
|
||||
NS_DispatchToMainThread(metadataLoadedEvent, NS_DISPATCH_NORMAL);
|
||||
mSentLoadedMetadataEvent = true;
|
||||
}
|
||||
@ -2288,11 +2268,8 @@ MediaDecoderStateMachine::EnqueueFirstFrameLoadedEvent()
|
||||
{
|
||||
nsAutoPtr<MediaInfo> info(new MediaInfo());
|
||||
*info = mInfo;
|
||||
MediaDecoderEventVisibility visibility = mSentFirstFrameLoadedEvent?
|
||||
MediaDecoderEventVisibility::Suppressed :
|
||||
MediaDecoderEventVisibility::Observable;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new FirstFrameLoadedEventRunner(mDecoder, info, visibility);
|
||||
new FirstFrameLoadedEventRunner(mDecoder, info, mSentFirstFrameLoadedEvent);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
mSentFirstFrameLoadedEvent = true;
|
||||
}
|
||||
@ -2497,10 +2474,7 @@ void MediaDecoderStateMachine::DecodeSeek()
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
nsCOMPtr<nsIRunnable> startEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mDecoder,
|
||||
&MediaDecoder::SeekingStarted,
|
||||
mCurrentSeekTarget.mEventVisibility);
|
||||
NS_NewRunnableMethod(mDecoder, &MediaDecoder::SeekingStarted);
|
||||
NS_DispatchToMainThread(startEvent, NS_DISPATCH_SYNC);
|
||||
}
|
||||
if (mState != DECODER_STATE_SEEKING) {
|
||||
@ -2578,15 +2552,6 @@ MediaDecoderStateMachine::OnSeekFailed(nsresult aResult)
|
||||
// Try again.
|
||||
mCurrentSeekTarget = mSeekTarget;
|
||||
mSeekTarget.Reset();
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
nsCOMPtr<nsIRunnable> startEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mDecoder,
|
||||
&MediaDecoder::SeekingStarted,
|
||||
mCurrentSeekTarget.mEventVisibility);
|
||||
NS_DispatchToMainThread(startEvent, NS_DISPATCH_SYNC);
|
||||
}
|
||||
mReader->Seek(mCurrentSeekTarget.mTime, mEndTime)
|
||||
->Then(DecodeTaskQueue(), __func__, this,
|
||||
&MediaDecoderStateMachine::OnSeekCompleted,
|
||||
@ -2673,20 +2638,14 @@ MediaDecoderStateMachine::SeekCompleted()
|
||||
// this if we're playing a live stream, since the end of media will advance
|
||||
// once we download more data!
|
||||
DECODER_LOG("Changed state from SEEKING (to %lld) to COMPLETED", seekTime);
|
||||
stopEvent = NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mDecoder,
|
||||
&MediaDecoder::SeekingStoppedAtEnd,
|
||||
mCurrentSeekTarget.mEventVisibility);
|
||||
stopEvent = NS_NewRunnableMethod(mDecoder, &MediaDecoder::SeekingStoppedAtEnd);
|
||||
// Explicitly set our state so we don't decode further, and so
|
||||
// we report playback ended to the media element.
|
||||
SetState(DECODER_STATE_COMPLETED);
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
} else {
|
||||
DECODER_LOG("Changed state from SEEKING (to %lld) to DECODING", seekTime);
|
||||
stopEvent = NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mDecoder,
|
||||
&MediaDecoder::SeekingStopped,
|
||||
mCurrentSeekTarget.mEventVisibility);
|
||||
stopEvent = NS_NewRunnableMethod(mDecoder, &MediaDecoder::SeekingStopped);
|
||||
StartDecoding();
|
||||
}
|
||||
|
||||
|
@ -99,14 +99,14 @@ SourceBufferDecoder::IsMediaSeekable()
|
||||
void
|
||||
SourceBufferDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility)
|
||||
bool aRestoredFromDormant)
|
||||
{
|
||||
MSE_DEBUG("UNIMPLEMENTED");
|
||||
}
|
||||
|
||||
void
|
||||
SourceBufferDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility)
|
||||
bool aRestoredFromDormant)
|
||||
{
|
||||
MSE_DEBUG("UNIMPLEMENTED");
|
||||
}
|
||||
|
@ -48,11 +48,8 @@ public:
|
||||
virtual SourceBufferResource* GetResource() const MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual ReentrantMonitor& GetReentrantMonitor() MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, bool aRestoredFromDormant) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, bool aRestoredFromDormant) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded, uint32_t aDropped) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
@ -360,11 +360,8 @@ status_t AudioOffloadPlayer::SeekTo(int64_t aTimeUs, bool aDispatchSeekEvents)
|
||||
mDispatchSeekEvents = aDispatchSeekEvents;
|
||||
|
||||
if (mDispatchSeekEvents) {
|
||||
nsCOMPtr<nsIRunnable> nsEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mObserver,
|
||||
&MediaDecoder::SeekingStarted,
|
||||
MediaDecoderEventVisibility::Observable);
|
||||
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
|
||||
&MediaDecoder::SeekingStarted);
|
||||
NS_DispatchToCurrentThread(nsEvent);
|
||||
}
|
||||
|
||||
@ -383,11 +380,8 @@ status_t AudioOffloadPlayer::SeekTo(int64_t aTimeUs, bool aDispatchSeekEvents)
|
||||
if (mDispatchSeekEvents) {
|
||||
mDispatchSeekEvents = false;
|
||||
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Fake seek complete during pause"));
|
||||
nsCOMPtr<nsIRunnable> nsEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mObserver,
|
||||
&MediaDecoder::SeekingStopped,
|
||||
MediaDecoderEventVisibility::Observable);
|
||||
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
|
||||
&MediaDecoder::SeekingStopped);
|
||||
NS_DispatchToCurrentThread(nsEvent);
|
||||
}
|
||||
}
|
||||
@ -446,11 +440,8 @@ void AudioOffloadPlayer::NotifyAudioEOS()
|
||||
|
||||
void AudioOffloadPlayer::NotifyPositionChanged()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> nsEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mObserver,
|
||||
&MediaOmxCommonDecoder::PlaybackPositionChanged,
|
||||
MediaDecoderEventVisibility::Observable);
|
||||
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
|
||||
&MediaOmxCommonDecoder::PlaybackPositionChanged);
|
||||
NS_DispatchToMainThread(nsEvent);
|
||||
}
|
||||
|
||||
@ -568,11 +559,8 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize)
|
||||
if (mDispatchSeekEvents && !mSeekDuringPause) {
|
||||
mDispatchSeekEvents = false;
|
||||
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("FillBuffer posting SEEK_COMPLETE"));
|
||||
nsCOMPtr<nsIRunnable> nsEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
mObserver,
|
||||
&MediaDecoder::SeekingStopped,
|
||||
MediaDecoderEventVisibility::Observable);
|
||||
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
|
||||
&MediaDecoder::SeekingStopped);
|
||||
NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
|
||||
|
||||
} else if (mSeekDuringPause) {
|
||||
|
@ -58,10 +58,10 @@ MediaOmxCommonDecoder::CheckDecoderCanOffloadAudio()
|
||||
|
||||
void
|
||||
MediaOmxCommonDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility)
|
||||
bool aRestoredFromDormant)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MediaDecoder::FirstFrameLoaded(aInfo, aEventVisibility);
|
||||
MediaDecoder::FirstFrameLoaded(aInfo, aRestoredFromDormant);
|
||||
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
if (!CheckDecoderCanOffloadAudio()) {
|
||||
@ -203,7 +203,7 @@ MediaOmxCommonDecoder::ApplyStateToStateMachine(PlayState aState)
|
||||
}
|
||||
|
||||
void
|
||||
MediaOmxCommonDecoder::PlaybackPositionChanged(MediaDecoderEventVisibility aEventVisibility)
|
||||
MediaOmxCommonDecoder::PlaybackPositionChanged()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mAudioOffloadPlayer) {
|
||||
@ -220,9 +220,7 @@ MediaOmxCommonDecoder::PlaybackPositionChanged(MediaDecoderEventVisibility aEven
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mCurrentTime = mAudioOffloadPlayer->GetMediaTimeSecs();
|
||||
}
|
||||
if (mOwner &&
|
||||
(aEventVisibility != MediaDecoderEventVisibility::Suppressed) &&
|
||||
lastTime != mCurrentTime) {
|
||||
if (mOwner && lastTime != mCurrentTime) {
|
||||
FireTimeUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -24,12 +24,11 @@ public:
|
||||
MediaOmxCommonDecoder();
|
||||
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility);
|
||||
bool aRestoredFromDormant);
|
||||
virtual void ChangeState(PlayState aState);
|
||||
virtual void ApplyStateToStateMachine(PlayState aState);
|
||||
virtual void SetVolume(double aVolume);
|
||||
virtual void PlaybackPositionChanged(MediaDecoderEventVisibility aEventVisibility =
|
||||
MediaDecoderEventVisibility::Observable);
|
||||
virtual void PlaybackPositionChanged();
|
||||
virtual void UpdateReadyStateForData();
|
||||
virtual void SetElementVisibility(bool aIsVisible);
|
||||
virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio);
|
||||
|
@ -364,8 +364,6 @@ skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 914439
|
||||
[test_defaultMuted.html]
|
||||
[test_delay_load.html]
|
||||
skip-if = buildapp == 'b2g' && toolkit != 'gonk' # bug 1082984
|
||||
[test_dormant_playback.html]
|
||||
skip-if = (os == 'win' && os_version == '5.1') || (os != 'win' && toolkit != 'gonk')
|
||||
[test_eme_access_control.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
|
||||
[test_eme_canvas_blocked.html]
|
||||
|
@ -1,82 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>Media test: Test resuming from dormant does not emit seek related events</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gNeedInit = false;
|
||||
var gLoadedEvent = false;
|
||||
var gSeekEvent = false;
|
||||
var v1 = null;
|
||||
|
||||
function startVideoPlayback() {
|
||||
v1.play()
|
||||
}
|
||||
|
||||
function setVideoVisible() {
|
||||
document.body.appendChild(v1);
|
||||
setTimeout(startVideoPlayback, 0);
|
||||
}
|
||||
|
||||
function checkResult() {
|
||||
ok(!gLoadedEvent, "loadedmetadata event should not happen");
|
||||
ok(!gSeekEvent, "seek event should not happen");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function loadedMetadata(e) {
|
||||
if (gNeedInit) {
|
||||
v1.currentTime = 0;
|
||||
return;
|
||||
}
|
||||
gLoadedEvent = true;
|
||||
}
|
||||
|
||||
function playbackEnded(e) {
|
||||
checkResult();
|
||||
}
|
||||
|
||||
function seekEnded(e) {
|
||||
if (gNeedInit) {
|
||||
gNeedInit = false;
|
||||
gLoadedEvent = false;
|
||||
gSeekEvent = false;
|
||||
document.body.removeChild(v1);
|
||||
setTimeout(setVideoVisible, 0);
|
||||
return;
|
||||
}
|
||||
gSeekEvent = true;
|
||||
}
|
||||
|
||||
function seeking(e) {
|
||||
gSeekEvent = true;
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
gNeedInit = true;
|
||||
|
||||
v1 = document.createElement('video');
|
||||
document.body.appendChild(v1);
|
||||
v1.preload = "metadata";
|
||||
v1.src = "gizmo.mp4"
|
||||
v1.addEventListener("loadedmetadata", loadedMetadata, false);
|
||||
v1.addEventListener("ended", playbackEnded, false);
|
||||
v1.addEventListener("seeked", seekEnded, false);
|
||||
v1.addEventListener("seeking", seeking, false);
|
||||
}
|
||||
|
||||
addLoadEvent(runTest);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -141,13 +141,13 @@ BufferDecoder::IsMediaSeekable()
|
||||
}
|
||||
|
||||
void
|
||||
BufferDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, MediaDecoderEventVisibility aEventVisibility)
|
||||
BufferDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, bool aRestoredFromDormant)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
BufferDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, MediaDecoderEventVisibility aEventVisibility)
|
||||
BufferDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, bool aRestoredFromDormant)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
@ -60,12 +60,9 @@ public:
|
||||
|
||||
virtual bool IsMediaSeekable() MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
nsAutoPtr<MetadataTags> aTags,
|
||||
MediaDecoderEventVisibility aEventVisibility) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, bool aRestoredFromDormant) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void QueueMetadata(int64_t aTime, nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
||||
MediaDecoderEventVisibility aEventVisibility) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, bool aRestoredFromDormant) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
virtual void RemoveMediaTracks() MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user