mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 881512 - Add hidden pref to ignore MIME type in AddSourceBuffer and IsTypeSupported. For experimental/debugging use only. r=cajbir
This commit is contained in:
parent
e50f2da194
commit
8873c272f6
@ -12,6 +12,7 @@
|
||||
#include "SourceBufferList.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
@ -72,6 +73,9 @@ IsTypeSupported(const nsAString& aType)
|
||||
if (!found) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
if (Preferences::GetBool("media.mediasource.ignore_codecs", false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
// Check aType against HTMLMediaElement list of MIME types. Since we've
|
||||
// already restricted the container format, this acts as a specific check
|
||||
// of any specified "codecs" parameter of aType.
|
||||
@ -145,6 +149,7 @@ already_AddRefed<SourceBuffer>
|
||||
MediaSource::AddSourceBuffer(const nsAString& aType, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = mozilla::IsTypeSupported(aType);
|
||||
MSE_DEBUG("MediaSource::AddSourceBuffer(Type=%s) -> %x", NS_ConvertUTF16toUTF8(aType).get(), rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
@ -179,6 +184,7 @@ void
|
||||
MediaSource::RemoveSourceBuffer(SourceBuffer& aSourceBuffer, ErrorResult& aRv)
|
||||
{
|
||||
SourceBuffer* sourceBuffer = &aSourceBuffer;
|
||||
MSE_DEBUG("%p RemoveSourceBuffer(Buffer=%p)", this, sourceBuffer);
|
||||
if (!mSourceBuffers->Contains(sourceBuffer)) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
|
||||
return;
|
||||
@ -207,6 +213,7 @@ MediaSource::RemoveSourceBuffer(SourceBuffer& aSourceBuffer, ErrorResult& aRv)
|
||||
void
|
||||
MediaSource::EndOfStream(const Optional<MediaSourceEndOfStreamError>& aError, ErrorResult& aRv)
|
||||
{
|
||||
MSE_DEBUG("%p EndOfStream(Error=%u)", this, aError.WasPassed() ? uint32_t(aError.Value()) : 0);
|
||||
if (mReadyState != MediaSourceReadyState::Open ||
|
||||
mSourceBuffers->AnyUpdating()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
@ -244,7 +251,14 @@ MediaSource::EndOfStream(const Optional<MediaSourceEndOfStreamError>& aError, Er
|
||||
/* static */ bool
|
||||
MediaSource::IsTypeSupported(const GlobalObject&, const nsAString& aType)
|
||||
{
|
||||
return NS_SUCCEEDED(mozilla::IsTypeSupported(aType));
|
||||
#ifdef PR_LOGGING
|
||||
if (!gMediaSourceLog) {
|
||||
gMediaSourceLog = PR_NewLogModule("MediaSource");
|
||||
}
|
||||
#endif
|
||||
nsresult rv = mozilla::IsTypeSupported(aType);
|
||||
MSE_DEBUG("MediaSource::IsTypeSupported(Type=%s) -> %x", NS_ConvertUTF16toUTF8(aType).get(), rv);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -294,6 +308,7 @@ void
|
||||
MediaSource::SetReadyState(MediaSourceReadyState aState)
|
||||
{
|
||||
MOZ_ASSERT(aState != mReadyState);
|
||||
MSE_DEBUG("%p SetReadyState old=%d new=%d", this, mReadyState, aState);
|
||||
|
||||
MediaSourceReadyState oldState = mReadyState;
|
||||
mReadyState = aState;
|
||||
|
Loading…
Reference in New Issue
Block a user