Bug 848994 - p1. Refactor Decoder Doctor - r=cpearce
Some refactoring, clean-ups, etc. The main change is that the can-play status is passed when diagnostics are finally recorded. This will help when introducing different types of diagnostics in future patches (e.g., Key System issues). MozReview-Commit-ID: 182ePlrMqn4
This commit is contained in:
@@ -1065,10 +1065,8 @@ void HTMLMediaElement::LoadFromSourceChildren()
|
||||
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
CanPlayStatus canPlay = GetCanPlay(type, &diagnostics);
|
||||
if (canPlay != CANPLAY_NO) {
|
||||
diagnostics.SetCanPlay();
|
||||
}
|
||||
diagnostics.StoreDiagnostics(OwnerDoc(), type, __func__);
|
||||
diagnostics.StoreFormatDiagnostics(
|
||||
OwnerDoc(), type, canPlay != CANPLAY_NO, __func__);
|
||||
if (canPlay == CANPLAY_NO) {
|
||||
DispatchAsyncSourceError(child);
|
||||
const char16_t* params[] = { type.get(), src.get() };
|
||||
@@ -2916,10 +2914,8 @@ HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult)
|
||||
{
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
CanPlayStatus canPlay = GetCanPlay(aType, &diagnostics);
|
||||
if (canPlay != CANPLAY_NO) {
|
||||
diagnostics.SetCanPlay();
|
||||
}
|
||||
diagnostics.StoreDiagnostics(OwnerDoc(), aType, __func__);
|
||||
diagnostics.StoreFormatDiagnostics(
|
||||
OwnerDoc(), aType, canPlay != CANPLAY_NO, __func__);
|
||||
switch (canPlay) {
|
||||
case CANPLAY_NO:
|
||||
aResult.Truncate();
|
||||
@@ -2983,12 +2979,10 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
RefPtr<MediaDecoder> decoder =
|
||||
DecoderTraits::CreateDecoder(mimeType, this, &diagnostics);
|
||||
if (decoder) {
|
||||
diagnostics.SetCanPlay();
|
||||
}
|
||||
diagnostics.StoreDiagnostics(OwnerDoc(),
|
||||
NS_ConvertASCIItoUTF16(mimeType),
|
||||
__func__);
|
||||
diagnostics.StoreFormatDiagnostics(OwnerDoc(),
|
||||
NS_ConvertASCIItoUTF16(mimeType),
|
||||
decoder != nullptr,
|
||||
__func__);
|
||||
if (!decoder) {
|
||||
nsAutoString src;
|
||||
GetCurrentSrc(src);
|
||||
|
||||
Reference in New Issue
Block a user