Bug 475110. Don't try to handle Wave files loaded via links or <object> using our Wave codec, since there are Wave formats we don't support that are actually used in the wild. r=doublec,a=beltzner

--HG--
extra : rebase_source : 562c7c7c17157082483e456f33aa8b211fd07aeb
This commit is contained in:
Robert O'Callahan 2009-05-25 12:42:19 +12:00
parent aac8436514
commit 3d39f15314
4 changed files with 28 additions and 9 deletions

View File

@ -205,8 +205,7 @@ public:
void Freeze();
void Thaw();
// Returns true if we can handle this MIME type in a <video> or <audio>
// element.
// Returns true if we can handle this MIME type.
// If it returns true, then it also returns a null-terminated list
// of supported codecs in *aSupportedCodecs, and a null-terminated list
// of codecs that *may* be supported in *aMaybeSupportedCodecs. These
@ -215,6 +214,12 @@ public:
const char*** aSupportedCodecs,
const char*** aMaybeSupportedCodecs);
// Returns true if we should handle this MIME type when it appears
// as an <object> or as a toplevel page. If, in practice, our support
// for the type is more limited than appears in the wild, we should return
// false here even if CanHandleMediaType would return true.
static PRBool ShouldHandleMediaType(const char* aMIMEType);
/**
* Initialize data for available media types
*/

View File

@ -958,7 +958,7 @@ static const char* gOggCodecs[] = {
static const char* gOggMaybeCodecs[] = {
nsnull
};
};
static PRBool IsOggEnabled()
{
@ -1037,6 +1037,21 @@ PRBool nsHTMLMediaElement::CanHandleMediaType(const char* aMIMEType,
return PR_FALSE;
}
/* static */
PRBool nsHTMLMediaElement::ShouldHandleMediaType(const char* aMIMEType)
{
#ifdef MOZ_OGG
if (IsOggType(nsDependentCString(aMIMEType)))
return PR_TRUE;
#endif
// We should not return true for Wave types, since there are some
// Wave codecs actually in use in the wild that we don't support, and
// we should allow those to be handled by plugins or helper apps.
// Furthermore people can play Wave files on most platforms by other
// means.
return PR_FALSE;
}
static PRBool
CodecListContains(const char** aCodecs, const nsAString& aCodec)
{

View File

@ -142,7 +142,6 @@ endif
ifdef MOZ_WAVE
_TEST_FILES += \
test_audioDocumentTitle.html \
big.wav \
test_bug463162.xhtml \
test_bug465498.html \
@ -165,7 +164,6 @@ _TEST_FILES += \
test_wav_seek8.html \
test_wav_seek_past_end.html \
test_wav_seek_then_play.html \
test_wav_standalone.html \
test_wav_timeupdate1.html \
test_wav_timeupdate2.html \
test_wav_trailing.html \
@ -183,6 +181,10 @@ _TEST_FILES += \
$(NULL)
endif
# Disabled since we don't play Wave files standalone, for now
# test_wav_standalone.html
# test_audioDocumentTitle.html
ifdef MOZ_OGG
ifdef MOZ_WAVE
_TEST_FILES += \

View File

@ -275,10 +275,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
}
#ifdef MOZ_MEDIA
const char** supportedCodecs;
const char** maybeSupportedCodecs;
if (nsHTMLMediaElement::CanHandleMediaType(aContentType,
&supportedCodecs, &maybeSupportedCodecs)) {
if (nsHTMLMediaElement::ShouldHandleMediaType(aContentType)) {
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kVideoDocumentCID,