Bug 1279865 - Don't run TimeMarchesOn if the MediaElement is not played. r=rillian
1. If mHasUserInteraction MediaElement is false, don't run the TimeMarchesOn because the element is not played. 2. Update the activeCueList only in TimeMarchesOn(). 3. Run TimeMarchesOn() at the beginning of play. r=rillian MozReview-Commit-ID: BhwsIfRm3B2
This commit is contained in:
@@ -2599,6 +2599,7 @@ HTMLMediaElement::PlayInternal(bool aCallerIsChrome)
|
|||||||
break;
|
break;
|
||||||
case nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA:
|
case nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA:
|
||||||
case nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA:
|
case nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA:
|
||||||
|
FireTimeUpdate(false);
|
||||||
DispatchAsyncEvent(NS_LITERAL_STRING("playing"));
|
DispatchAsyncEvent(NS_LITERAL_STRING("playing"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -713,6 +713,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetHasUserInteraction()
|
||||||
|
{
|
||||||
|
return mHasUserInteraction;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A method to check whether we are currently playing.
|
||||||
|
bool IsCurrentlyPlaying() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A public wrapper for FinishDecoderSetup()
|
* A public wrapper for FinishDecoderSetup()
|
||||||
*/
|
*/
|
||||||
@@ -1138,9 +1146,6 @@ protected:
|
|||||||
// A method to check if we are playing through the AudioChannel.
|
// A method to check if we are playing through the AudioChannel.
|
||||||
bool IsPlayingThroughTheAudioChannel() const;
|
bool IsPlayingThroughTheAudioChannel() const;
|
||||||
|
|
||||||
// A method to check whether we are currently playing.
|
|
||||||
bool IsCurrentlyPlaying() const;
|
|
||||||
|
|
||||||
// Update the audio channel playing state
|
// Update the audio channel playing state
|
||||||
void UpdateAudioChannelPlayingState();
|
void UpdateAudioChannelPlayingState();
|
||||||
|
|
||||||
|
|||||||
@@ -524,7 +524,8 @@ TextTrackManager::DispatchTimeMarchesOn()
|
|||||||
// enqueue the current playback position and whether only that changed
|
// enqueue the current playback position and whether only that changed
|
||||||
// through its usual monotonic increase during normal playback; current
|
// through its usual monotonic increase during normal playback; current
|
||||||
// executing call upon completion will check queue for further 'work'.
|
// executing call upon completion will check queue for further 'work'.
|
||||||
if (!mTimeMarchesOnDispatched && !mShutdown) {
|
if (!mTimeMarchesOnDispatched && !mShutdown &&
|
||||||
|
(mMediaElement->GetHasUserInteraction() || mMediaElement->IsCurrentlyPlaying())) {
|
||||||
NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
|
NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
|
||||||
mTimeMarchesOnDispatched = true;
|
mTimeMarchesOnDispatched = true;
|
||||||
}
|
}
|
||||||
@@ -570,6 +571,7 @@ TextTrackManager::TimeMarchesOn()
|
|||||||
TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
|
TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
|
||||||
if (ttrack && dummy) {
|
if (ttrack && dummy) {
|
||||||
// TODO: call GetCueListByTimeInterval on mNewCues?
|
// TODO: call GetCueListByTimeInterval on mNewCues?
|
||||||
|
ttrack->UpdateActiveCueList();
|
||||||
TextTrackCueList* activeCueList = ttrack->GetActiveCues();
|
TextTrackCueList* activeCueList = ttrack->GetActiveCues();
|
||||||
if (activeCueList) {
|
if (activeCueList) {
|
||||||
for (uint32_t i = 0; i < activeCueList->Length(); ++i) {
|
for (uint32_t i = 0; i < activeCueList->Length(); ++i) {
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ TextTrack::UpdateActiveCueList()
|
|||||||
TextTrackCueList*
|
TextTrackCueList*
|
||||||
TextTrack::GetActiveCues() {
|
TextTrack::GetActiveCues() {
|
||||||
if (mMode != TextTrackMode::Disabled) {
|
if (mMode != TextTrackMode::Disabled) {
|
||||||
UpdateActiveCueList();
|
|
||||||
return mActiveCueList;
|
return mActiveCueList;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -225,7 +224,6 @@ void
|
|||||||
TextTrack::GetActiveCueArray(nsTArray<RefPtr<TextTrackCue> >& aCues)
|
TextTrack::GetActiveCueArray(nsTArray<RefPtr<TextTrackCue> >& aCues)
|
||||||
{
|
{
|
||||||
if (mMode != TextTrackMode::Disabled) {
|
if (mMode != TextTrackMode::Disabled) {
|
||||||
UpdateActiveCueList();
|
|
||||||
mActiveCueList->GetArray(aCues);
|
mActiveCueList->GetArray(aCues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user