Bug 1362793 - part1 : shouldn't shutdown decoder too early. r=jwwang

The spec says that we don't need to change the ready state when getting the error.
If the ready state is "HAVE_METADATA", it means we could get the video's duration
at that time.

However, if we shutdown decoder too early, we won't get the correct duration.

In addition, since we remove old decoder prior to create new one in the function
HTMLMediaElement::SetDecoder(), we can remove the decoder checking assertion
in HTMLMediaElement::InitializeDecoderForChannel().

MozReview-Commit-ID: CHRJHng8Xm0
This commit is contained in:
Alastor Wu
2017-05-19 12:38:17 +08:00
parent d32facf80e
commit 152e2f5930

View File

@@ -4613,7 +4613,6 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
nsIStreamListener** aListener)
{
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
nsAutoCString mimeType;
@@ -5281,10 +5280,6 @@ void HTMLMediaElement::DecodeError(const MediaResult& aError)
AudioTracks()->EmptyTracks();
VideoTracks()->EmptyTracks();
if (mIsLoadingFromSourceChildren) {
if (mDecoder) {
// Shut down the exiting decoder before loading the next source child.
ShutdownDecoder();
}
mErrorSink->ResetError();
if (mSourceLoadCandidate) {
DispatchAsyncSourceError(mSourceLoadCandidate);