Backed out 3 changesets (bug 1282410)

Backed out changeset 39c367ecc144 (bug 1282410)
Backed out changeset 577309fc4bbb (bug 1282410)
Backed out changeset 339b5c5d3595 (bug 1282410)

MozReview-Commit-ID: 17IgTjbib20
This commit is contained in:
Sebastian Kaspari
2016-07-18 17:26:25 +02:00
parent 2f707909b4
commit 3aa2c7f730
4 changed files with 9 additions and 60 deletions

View File

@@ -1030,7 +1030,6 @@ void HTMLMediaElement::NoSupportedMediaSourceError()
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
ChangeDelayLoadStatus(false);
UpdateAudioChannelPlayingState();
OpenUnsupportedMediaWithExtenalAppIfNeeded();
}
typedef void (HTMLMediaElement::*SyncSectionFn)();
@@ -2695,10 +2694,6 @@ HTMLMediaElement::PlayInternal(bool aCallerIsChrome)
UpdateSrcMediaStreamPlaying();
UpdateAudioChannelPlayingState();
// The check here is to handle the case that the media element starts playing
// after it loaded fail. eg. preload the data before playing.
OpenUnsupportedMediaWithExtenalAppIfNeeded();
return NS_OK;
}
@@ -3199,26 +3194,28 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
aChannel->GetContentType(mMimeType);
NS_ASSERTION(!mMimeType.IsEmpty(), "We should have the Content-Type.");
nsAutoCString mimeType;
aChannel->GetContentType(mimeType);
NS_ASSERTION(!mimeType.IsEmpty(), "We should have the Content-Type.");
DecoderDoctorDiagnostics diagnostics;
RefPtr<MediaDecoder> decoder =
DecoderTraits::CreateDecoder(mMimeType, this, &diagnostics);
DecoderTraits::CreateDecoder(mimeType, this, &diagnostics);
diagnostics.StoreFormatDiagnostics(OwnerDoc(),
NS_ConvertASCIItoUTF16(mMimeType),
NS_ConvertASCIItoUTF16(mimeType),
decoder != nullptr,
__func__);
if (!decoder) {
nsAutoString src;
GetCurrentSrc(src);
NS_ConvertUTF8toUTF16 mimeUTF16(mMimeType);
NS_ConvertUTF8toUTF16 mimeUTF16(mimeType);
const char16_t* params[] = { mimeUTF16.get(), src.get() };
ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params));
return NS_ERROR_FAILURE;
}
LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mMimeType.get()));
LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get()));
RefPtr<MediaResource> resource =
MediaResource::Create(decoder->GetResourceCallback(), aChannel);
@@ -3234,7 +3231,7 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
// We postpone the |FinishDecoderSetup| function call until we get
// |OnConnected| signal from MediaStreamController which is held by
// RtspMediaResource.
if (DecoderTraits::DecoderWaitsForOnConnected(mMimeType)) {
if (DecoderTraits::DecoderWaitsForOnConnected(mimeType)) {
decoder->SetResource(resource);
SetDecoder(decoder);
if (aListener) {
@@ -5932,43 +5929,6 @@ HTMLMediaElement::IsAudible() const
return true;
}
bool
HTMLMediaElement::HaveFailedWithSourceNotSupportedError() const
{
if (!mError) {
return false;
}
uint16_t errorCode;
mError->GetCode(&errorCode);
return (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE &&
errorCode == nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
}
void
HTMLMediaElement::OpenUnsupportedMediaWithExtenalAppIfNeeded()
{
if (!Preferences::GetBool("media.openUnsupportedTypeWithExternalApp")) {
return;
}
if (!HaveFailedWithSourceNotSupportedError()) {
return;
}
// If media doesn't start playing, we don't need to open it.
if (mPaused) {
return;
}
LOG(LogLevel::Debug, ("Open unsupported type \'%s\' with external apps.",
mMimeType.get()));
nsContentUtils::DispatchTrustedEvent(OwnerDoc(), static_cast<nsIContent*>(this),
NS_LITERAL_STRING("OpenMediaWithExtenalApp"),
true,
true);
}
static const char* VisibilityString(Visibility aVisibility) {
switch(aVisibility) {
case Visibility::UNTRACKED: {