Bug 1391170 - lessen the assertion in AddMediaElementToURITable() so we can move MediaDecoder::GetResource() to private. r=gerald

If AddMediaElementToURITable() is called after the decoder Load failed, mDecoder
will be reset and it is sufficient to assert mDecoder only.

MozReview-Commit-ID: 58WT8zFeiFj

--HG--
extra : rebase_source : 712579b544e9a9ce971778b85795d06e58bd4ea5
extra : intermediate-source : 470e2d8a20010e11d7a7dce5540957e89439811e
extra : source : 59f4b2b33212794aa1cf3e8782737a2d4af8c241
This commit is contained in:
JW Wang 2017-08-17 15:41:22 +08:00
Родитель d824321d11
Коммит 2834911596
5 изменённых файлов: 15 добавлений и 16 удалений

Просмотреть файл

@ -3693,7 +3693,7 @@ MediaElementTableCount(HTMLMediaElement* aElement, nsIURI* aURI)
void
HTMLMediaElement::AddMediaElementToURITable()
{
NS_ASSERTION(mDecoder && mDecoder->GetResource(), "Call this only with decoder Load called");
NS_ASSERTION(mDecoder, "Call this only with decoder Load called");
NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0,
"Should not have entry for element in element table before addition");
if (!gElementTable) {

Просмотреть файл

@ -67,8 +67,6 @@ protected:
public:
explicit ChannelMediaDecoder(MediaDecoderInit& aInit);
MediaResource* GetResource() const override final;
void Shutdown() override;
bool CanClone();
@ -85,6 +83,8 @@ public:
void Resume() override;
private:
MediaResource* GetResource() const override final;
// Create a new state machine to run this decoder.
MediaDecoderStateMachine* CreateStateMachine();

Просмотреть файл

@ -120,15 +120,6 @@ public:
// Called if the media file encounters a network error.
void NetworkError();
// Get the current MediaResource being used.
// Note: The MediaResource is refcounted, but it outlives the MediaDecoder,
// so it's OK to use the reference returned by this function without
// refcounting, *unless* you need to store and use the reference after the
// MediaDecoder has been destroyed. You might need to do this if you're
// wrapping the MediaResource in some kind of byte stream interface to be
// passed to a platform decoder.
virtual MediaResource* GetResource() const = 0;
// Return the principal of the current URI being played or downloaded.
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal();
@ -490,6 +481,15 @@ protected:
media::TimeUnit::FromMicroseconds(250000);
private:
// Get the current MediaResource being used.
// Note: The MediaResource is refcounted, but it outlives the MediaDecoder,
// so it's OK to use the reference returned by this function without
// refcounting, *unless* you need to store and use the reference after the
// MediaDecoder has been destroyed. You might need to do this if you're
// wrapping the MediaResource in some kind of byte stream interface to be
// passed to a platform decoder.
virtual MediaResource* GetResource() const = 0;
nsCString GetDebugInfo();
// Called when the owner's activity changed.

Просмотреть файл

@ -21,8 +21,6 @@ public:
{
}
MediaResource* GetResource() const override final;
void Shutdown() override;
// Returns true if the HLS backend is pref'ed on.
@ -43,6 +41,8 @@ public:
void Resume() override;
private:
MediaResource* GetResource() const override final;
MediaDecoderStateMachine* CreateStateMachine();
bool CanPlayThroughImpl() override final

Просмотреть файл

@ -27,8 +27,6 @@ class MediaSourceDecoder : public MediaDecoder
public:
explicit MediaSourceDecoder(MediaDecoderInit& aInit);
MediaResource* GetResource() const override final;
nsresult Load(nsIPrincipal* aPrincipal);
media::TimeIntervals GetSeekable() override;
media::TimeIntervals GetBuffered() override;
@ -64,6 +62,7 @@ public:
void NotifyInitDataArrived();
private:
MediaResource* GetResource() const override final;
MediaDecoderStateMachine* CreateStateMachine();
void DoSetMediaSourceDuration(double aDuration);
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);