Bug 1348432 - move the mMediaTracksConstructed flag back to MediaDecoder; r=jwwang

This mMediaTracksConstructed flag should belong to a MediaDecoder,
every time a HTMLMediaElement switches its MediaDecoder, the flag should be reset to false again.

So, we move the mMediaTracksConstructed flag back to MediaDecoder, by this way,
HTMLMediaElement provides only the mechanism to construct and remove media tracks,
and MediaDecoder uses the flag, mMediaTracksConstructed, to provide policy.

MozReview-Commit-ID: L7mMAmLjQCy
This commit is contained in:
Kaku Kuo
2017-03-18 22:34:01 +08:00
parent 13ba8c0abf
commit e9a80160e4
4 changed files with 48 additions and 16 deletions

View File

@@ -3723,7 +3723,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
mDefaultPlaybackStartPosition(0.0),
mIsAudioTrackAudible(false),
mHasSuspendTaint(false),
mMediaTracksConstructed(false),
mVisibilityState(Visibility::UNTRACKED),
mErrorSink(new ErrorSink(this)),
mAudioChannelWrapper(new AudioChannelAgentCallback(this, mAudioChannel))
@@ -7423,11 +7422,7 @@ HTMLMediaElement::GetDocument() const
void
HTMLMediaElement::ConstructMediaTracks(const MediaInfo* aInfo)
{
if (mMediaTracksConstructed || !aInfo) {
return;
}
mMediaTracksConstructed = true;
MOZ_ASSERT(aInfo);
AudioTrackList* audioList = AudioTracks();
if (audioList && aInfo->HasAudio()) {
@@ -7461,8 +7456,6 @@ HTMLMediaElement::RemoveMediaTracks()
if (videoList) {
videoList->RemoveTracks();
}
mMediaTracksConstructed = false;
}
class MediaElementGMPCrashHelper : public GMPCrashHelper