Backed out 10 changesets (bug 1390748) for build bustage

Backed out changeset 02b36ee5fb17 (bug 1390748)
Backed out changeset 84e8bf01c856 (bug 1390748)
Backed out changeset fc8989be30f3 (bug 1390748)
Backed out changeset 14d421ace6cc (bug 1390748)
Backed out changeset 7dadac869038 (bug 1390748)
Backed out changeset 0e77809e7bc2 (bug 1390748)
Backed out changeset bf78a8dce9c5 (bug 1390748)
Backed out changeset 5fa77990472e (bug 1390748)
Backed out changeset 5d3b637d2485 (bug 1390748)
Backed out changeset 634fe076d134 (bug 1390748)

MozReview-Commit-ID: Dxio8vXDCHg
This commit is contained in:
Phil Ringnalda 2017-08-16 21:33:10 -07:00
Родитель 4748ebca90
Коммит 38ce1ea2a0
34 изменённых файлов: 271 добавлений и 99 удалений

Просмотреть файл

@ -22,6 +22,7 @@
#include "jsfriendapi.h"
#include "js/Value.h"
#include "Layers.h"
#include "MediaDecoder.h"
#include "nsAppRunner.h"
// nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h.
#include "nsNPAPIPluginInstance.h"
@ -47,6 +48,7 @@
#include "mozilla/dom/FileSystemSecurity.h"
#include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/HTMLShadowElement.h"

Просмотреть файл

@ -28,6 +28,9 @@
#include "mozilla/layers/APZCCallbackHelper.h"
#include "ClientLayerManager.h"
#include "nsQueryObject.h"
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#endif
#include "CubebUtils.h"
#include "nsIScrollableFrame.h"

Просмотреть файл

@ -7153,17 +7153,6 @@ HTMLMediaElement::NextFrameStatus()
return NEXT_FRAME_UNINITIALIZED;
}
void
HTMLMediaElement::SetDecoder(MediaDecoder* aDecoder)
{
MOZ_ASSERT(aDecoder); // Use ShutdownDecoder() to clear.
if (mDecoder) {
ShutdownDecoder();
}
mDecoder = aDecoder;
}
float
HTMLMediaElement::ComputedVolume() const
{

Просмотреть файл

@ -9,8 +9,6 @@
#include "nsAutoPtr.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsGenericHTMLElement.h"
#include "MediaEventSource.h"
#include "SeekTarget.h"
#include "MediaDecoderOwner.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIObserver.h"
@ -20,6 +18,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/TextTrackManager.h"
#include "mozilla/WeakPtr.h"
#include "MediaDecoder.h"
#include "mozilla/dom/MediaKeys.h"
#include "mozilla/StateWatching.h"
#include "nsGkAtoms.h"
@ -50,9 +49,6 @@ class DOMMediaStream;
class ErrorResult;
class MediaResource;
class MediaDecoder;
class MediaInputPort;
class MediaStream;
class MediaStreamGraph;
class VideoFrameContainer;
namespace dom {
class MediaKeys;
@ -812,7 +808,13 @@ protected:
MediaDecoderOwner::NextFrameStatus NextFrameStatus();
void SetDecoder(MediaDecoder* aDecoder);
void SetDecoder(MediaDecoder* aDecoder) {
MOZ_ASSERT(aDecoder); // Use ShutdownDecoder() to clear.
if (mDecoder) {
ShutdownDecoder();
}
mDecoder = aDecoder;
}
class WakeLockBoolWrapper {
public:

Просмотреть файл

@ -11,9 +11,6 @@
#include "mozilla/dom/HTMLMediaElement.h"
namespace mozilla {
class FrameStatistics;
namespace dom {
class WakeLock;

Просмотреть файл

@ -5,11 +5,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ADTSDecoder.h"
#include "ADTSDemuxer.h"
#include "MediaContainerType.h"
#include "PDMFactory.h"
namespace mozilla {
ChannelMediaDecoder*
ADTSDecoder::CloneImpl(MediaDecoderInit& aInit)
{
if (!IsEnabled())
return nullptr;
return new ADTSDecoder(aInit);
}
/* static */ bool
ADTSDecoder::IsEnabled()
{

Просмотреть файл

@ -7,17 +7,28 @@
#ifndef ADTS_DECODER_H_
#define ADTS_DECODER_H_
#include "ChannelMediaDecoder.h"
namespace mozilla {
class MediaContainerType;
class ADTSDecoder
class ADTSDecoder : public ChannelMediaDecoder
{
public:
// MediaDecoder interface.
explicit ADTSDecoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{
}
// Returns true if the ADTS backend is pref'ed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsEnabled();
static bool IsSupportedType(const MediaContainerType& aContainerType);
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
};
} // namespace mozilla

Просмотреть файл

@ -174,10 +174,10 @@ ChannelMediaDecoder::CanClone()
already_AddRefed<ChannelMediaDecoder>
ChannelMediaDecoder::Clone(MediaDecoderInit& aInit)
{
if (!mResource || !DecoderTraits::IsSupportedType(aInit.mContainerType)) {
if (!mResource) {
return nullptr;
}
RefPtr<ChannelMediaDecoder> decoder = new ChannelMediaDecoder(aInit);
RefPtr<ChannelMediaDecoder> decoder = CloneImpl(aInit);
if (!decoder) {
return nullptr;
}

Просмотреть файл

@ -67,6 +67,8 @@ protected:
public:
explicit ChannelMediaDecoder(MediaDecoderInit& aInit);
MediaDecoderStateMachine* CreateStateMachine() override;
MediaResource* GetResource() const override final;
void Shutdown() override;
@ -85,9 +87,7 @@ public:
void Resume() override;
private:
// Create a new state machine to run this decoder.
MediaDecoderStateMachine* CreateStateMachine();
virtual ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) = 0;
nsresult OpenResource(nsIStreamListener** aStreamListener);
nsresult Load(BaseMediaResource* aOriginal);

Просмотреть файл

@ -233,8 +233,36 @@ InstantiateDecoder(MediaDecoderInit& aInit,
RefPtr<ChannelMediaDecoder> decoder;
const MediaContainerType& type = aInit.mContainerType;
if (DecoderTraits::IsSupportedType(type)) {
decoder = new ChannelMediaDecoder(aInit);
#ifdef MOZ_FMP4
if (MP4Decoder::IsSupportedType(type, aDiagnostics)) {
decoder = new MP4Decoder(aInit);
return decoder.forget();
}
#endif
if (MP3Decoder::IsSupportedType(type)) {
decoder = new MP3Decoder(aInit);
return decoder.forget();
}
if (ADTSDecoder::IsSupportedType(type)) {
decoder = new ADTSDecoder(aInit);
return decoder.forget();
}
if (OggDecoder::IsSupportedType(type)) {
decoder = new OggDecoder(aInit);
return decoder.forget();
}
if (WaveDecoder::IsSupportedType(type)) {
decoder = new WaveDecoder(aInit);
return decoder.forget();
}
if (FlacDecoder::IsSupportedType(type)) {
decoder = new FlacDecoder(aInit);
return decoder.forget();
}
if (WebMDecoder::IsSupportedType(type)) {
decoder = new WebMDecoder(aInit);
return decoder.forget();
}
@ -283,10 +311,7 @@ DecoderTraits::CreateReader(const MediaContainerType& aType,
decoderReader = new MediaFormatReader(aInit, new FlacDemuxer(resource));
} else
if (OggDecoder::IsSupportedType(aType)) {
RefPtr<OggDemuxer> demuxer = new OggDemuxer(resource);
decoderReader = new MediaFormatReader(aInit, demuxer);
demuxer->SetChainingEvents(&decoderReader->TimedMetadataProducer(),
&decoderReader->MediaNotSeekableProducer());
decoderReader = new MediaFormatReader(aInit, new OggDemuxer(resource));
} else
if (WebMDecoder::IsSupportedType(aType)) {
decoderReader = new MediaFormatReader(aInit, new WebMDemuxer(resource));
@ -295,30 +320,6 @@ DecoderTraits::CreateReader(const MediaContainerType& aType,
return decoderReader;
}
/* static */
bool
DecoderTraits::IsSupportedType(const MediaContainerType& aType)
{
typedef bool (*IsSupportedFunction)(const MediaContainerType& aType);
static const IsSupportedFunction funcs[] = {
&ADTSDecoder::IsSupportedType,
&FlacDecoder::IsSupportedType,
&MP3Decoder::IsSupportedType,
#ifdef MOZ_FMP4
&MP4Decoder::IsSupportedTypeWithoutDiagnostics,
#endif
&OggDecoder::IsSupportedType,
&WaveDecoder::IsSupportedType,
&WebMDecoder::IsSupportedType,
};
for (IsSupportedFunction func : funcs) {
if (func(aType)) {
return true;
}
}
return false;
}
/* static */
bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
{

Просмотреть файл

@ -65,8 +65,6 @@ public:
// Returns true if aType is MIME type of hls.
static bool IsHttpLiveStreamingType(const MediaContainerType& aType);
static bool IsSupportedType(const MediaContainerType& aType);
};
} // namespace mozilla

Просмотреть файл

@ -1621,14 +1621,6 @@ MediaDecoder::RequestDebugInfo()
});
}
void
MediaDecoder::GetMozDebugReaderData(nsACString& aString)
{
if (mReader) {
mReader->GetMozDebugReaderData(aString);
}
}
void
MediaDecoder::NotifyAudibleStateChanged()
{

Просмотреть файл

@ -108,6 +108,10 @@ public:
// Safe to call from any thread.
const MediaContainerType& ContainerType() const { return mContainerType; }
// Create a new state machine to run this decoder.
// Subclasses must implement this.
virtual MediaDecoderStateMachine* CreateStateMachine() = 0;
// Cleanup internal data structures. Must be called on the main
// thread by the owning object before that object disposes of this object.
virtual void Shutdown();
@ -203,6 +207,7 @@ public:
// Must be called before Shutdown().
bool OwnerHasError() const;
public:
// Returns true if this media supports random seeking. False for example with
// chained ogg files.
bool IsMediaSeekable();
@ -406,7 +411,7 @@ private:
// Returns a string describing the state of the media player internal
// data. Used for debugging purposes.
virtual void GetMozDebugReaderData(nsACString& aString);
virtual void GetMozDebugReaderData(nsACString& aString) { }
virtual void DumpDebugInfo();

Просмотреть файл

@ -33,7 +33,6 @@
#include <algorithm>
#include "nsProxyRelease.h"
#include "nsIContentPolicy.h"
#include "mozilla/ErrorNames.h"
using mozilla::media::TimeUnit;

Просмотреть файл

@ -10,6 +10,9 @@
#include "mozilla/Preferences.h"
#include "MediaContainerType.h"
#include "MediaPrefs.h"
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#endif
#ifdef XP_WIN
#include "WMFDecoderModule.h"
#endif

Просмотреть файл

@ -23,6 +23,9 @@
#include "nsContentUtils.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsContentTypeParser.h"
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#endif
#ifdef XP_WIN
#include "mozilla/WindowsVersion.h"
#endif

Просмотреть файл

@ -5,11 +5,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FlacDecoder.h"
#include "FlacDemuxer.h"
#include "MediaContainerType.h"
#include "MediaPrefs.h"
namespace mozilla {
ChannelMediaDecoder*
FlacDecoder::CloneImpl(MediaDecoderInit& aInit)
{
if (!IsEnabled()) {
return nullptr;
}
return new FlacDecoder(aInit);
}
/* static */ bool
FlacDecoder::IsEnabled()
{

Просмотреть файл

@ -7,17 +7,28 @@
#ifndef FLAC_DECODER_H_
#define FLAC_DECODER_H_
#include "ChannelMediaDecoder.h"
namespace mozilla {
class MediaContainerType;
class FlacDecoder
class FlacDecoder : public ChannelMediaDecoder
{
public:
// MediaDecoder interface.
explicit FlacDecoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{
}
// Returns true if the Flac backend is pref'ed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsEnabled();
static bool IsSupportedType(const MediaContainerType& aContainerType);
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
};
} // namespace mozilla

Просмотреть файл

@ -6,14 +6,30 @@
#include "MP4Decoder.h"
#include "MediaContainerType.h"
#include "MediaFormatReader.h"
#include "MP4Demuxer.h"
#include "mozilla/Preferences.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/Logging.h"
#include "mozilla/SharedThreadPool.h"
#include "nsMimeTypes.h"
#include "VideoUtils.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsIGfxInfo.h"
#endif
#include "mozilla/layers/LayersTypes.h"
#include "PDMFactory.h"
namespace mozilla {
MP4Decoder::MP4Decoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{
}
static bool
IsWhitelistedH264Codec(const nsAString& aCodec)
{
@ -39,14 +55,6 @@ IsWhitelistedH264Codec(const nsAString& aCodec)
profile == H264_PROFILE_HIGH);
}
/* static */
bool
MP4Decoder::IsSupportedTypeWithoutDiagnostics(
const MediaContainerType& aContainerType)
{
return IsSupportedType(aContainerType, nullptr);
}
/* static */
bool
MP4Decoder::IsSupportedType(const MediaContainerType& aType,
@ -270,4 +278,12 @@ MP4Decoder::IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlo
return promise.forget();
}
void
MP4Decoder::GetMozDebugReaderData(nsACString& aString)
{
if (mReader) {
mReader->GetMozDebugReaderData(aString);
}
}
} // namespace mozilla

Просмотреть файл

@ -6,26 +6,26 @@
#if !defined(MP4Decoder_h_)
#define MP4Decoder_h_
class nsACString;
#include "ChannelMediaDecoder.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/layers/KnowsCompositor.h"
namespace mozilla {
class MediaContainerType;
class DecoderDoctorDiagnostics;
// Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4.
class MP4Decoder
class MP4Decoder : public ChannelMediaDecoder
{
public:
explicit MP4Decoder(MediaDecoderInit& aInit);
// Returns true if aContainerType is an MP4 type that we think we can render
// with the a platform decoder backend.
// If provided, codecs are checked for support.
static bool IsSupportedType(const MediaContainerType& aContainerType,
DecoderDoctorDiagnostics* aDiagnostics);
static bool IsSupportedTypeWithoutDiagnostics(
const MediaContainerType& aContainerType);
// Return true if aMimeType is a one of the strings used by our demuxers to
// identify H264. Does not parse general content type strings, i.e. white
// space matters.
@ -42,6 +42,16 @@ public:
static already_AddRefed<dom::Promise>
IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlobalObject* aParent);
void GetMozDebugReaderData(nsACString& aString) override;
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override
{
if (!IsEnabled()) {
return nullptr;
}
return new MP4Decoder(aInit);
}
};
} // namespace mozilla

Просмотреть файл

@ -8,6 +8,7 @@
#include "MockMediaResource.h"
#include "DecoderTraits.h"
#include "MediaContainerType.h"
#include "MP4Decoder.h"
#include "MP4Demuxer.h"
#include "WebMDecoder.h"
#include "WebMDemuxer.h"

Просмотреть файл

@ -29,6 +29,7 @@ public:
MediaResource* GetResource() const override final;
MediaDecoderStateMachine* CreateStateMachine() override;
nsresult Load(nsIPrincipal* aPrincipal);
media::TimeIntervals GetSeekable() override;
media::TimeIntervals GetBuffered() override;
@ -64,7 +65,6 @@ public:
void NotifyInitDataArrived();
private:
MediaDecoderStateMachine* CreateStateMachine();
void DoSetMediaSourceDuration(double aDuration);
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
bool CanPlayThroughImpl() override;

Просмотреть файл

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
@ -5,11 +6,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MP3Decoder.h"
#include "MediaContainerType.h"
#include "MP3Demuxer.h"
#include "PDMFactory.h"
namespace mozilla {
ChannelMediaDecoder*
MP3Decoder::CloneImpl(MediaDecoderInit& aInit)
{
if (!IsEnabled()) {
return nullptr;
}
return new MP3Decoder(aInit);
}
/* static */
bool
MP3Decoder::IsEnabled() {

Просмотреть файл

@ -6,17 +6,28 @@
#ifndef MP3Decoder_h_
#define MP3Decoder_h_
#include "ChannelMediaDecoder.h"
namespace mozilla {
class MediaContainerType;
class MP3Decoder
class MP3Decoder : public ChannelMediaDecoder
{
public:
// MediaDecoder interface.
explicit MP3Decoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{
}
// Returns true if the MP3 backend is preffed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsEnabled();
static bool IsSupportedType(const MediaContainerType& aContainerType);
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
};
} // namespace mozilla

Просмотреть файл

@ -4,13 +4,29 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "OggDecoder.h"
#include "MediaPrefs.h"
#include "MediaContainerType.h"
#include "MediaDecoder.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "OggDemuxer.h"
#include "OggDecoder.h"
namespace mozilla {
MediaDecoderStateMachine* OggDecoder::CreateStateMachine()
{
RefPtr<OggDemuxer> demuxer = new OggDemuxer(mResource);
MediaFormatReaderInit init;
init.mVideoFrameContainer = GetVideoFrameContainer();
init.mKnowsCompositor = GetCompositor();
init.mCrashHelper = GetOwner()->CreateGMPCrashHelper();
init.mFrameStats = mFrameStats;
mReader = new MediaFormatReader(init, demuxer);
demuxer->SetChainingEvents(&mReader->TimedMetadataProducer(),
&mReader->MediaNotSeekableProducer());
return new MediaDecoderStateMachine(this, mReader);
}
/* static */
bool
OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
@ -35,7 +51,7 @@ OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
// Verify that all the codecs specified are ones that we expect that
// we can play.
for (const auto& codec : codecs.Range()) {
if ((MediaDecoder::IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
if ((IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
codec.EqualsLiteral("vorbis") ||
(MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
continue;

Просмотреть файл

@ -6,17 +6,34 @@
#if !defined(OggDecoder_h_)
#define OggDecoder_h_
#include "ChannelMediaDecoder.h"
namespace mozilla {
class MediaContainerType;
class OggDecoder
class OggDecoder : public ChannelMediaDecoder
{
public:
explicit OggDecoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{}
MediaDecoderStateMachine* CreateStateMachine() override;
// Returns true if aContainerType is an Ogg type that we think we can render
// with an enabled platform decoder backend.
// If provided, codecs are checked for support.
static bool IsSupportedType(const MediaContainerType& aContainerType);
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override
{
if (!IsOggEnabled()) {
return nullptr;
}
return new OggDecoder(aInit);
}
};
} // namespace mozilla

Просмотреть файл

@ -8,6 +8,7 @@
#include "EMEVideoDecoder.h"
#include "GMPDecoderModule.h"
#include "GMPService.h"
#include "MP4Decoder.h"
#include "MediaInfo.h"
#include "MediaPrefs.h"
#include "PDMFactory.h"

Просмотреть файл

@ -4,16 +4,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WaveDecoder.h"
#include "WaveDemuxer.h"
#include "MediaContainerType.h"
#include "MediaDecoder.h"
#include "WaveDecoder.h"
#include "PDMFactory.h"
namespace mozilla {
ChannelMediaDecoder*
WaveDecoder::CloneImpl(MediaDecoderInit& aInit)
{
return new WaveDecoder(aInit);
}
/* static */ bool
WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (!MediaDecoder::IsWaveEnabled()) {
if (!IsWaveEnabled()) {
return false;
}
if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")

Просмотреть файл

@ -6,16 +6,27 @@
#if !defined(WaveDecoder_h_)
#define WaveDecoder_h_
#include "ChannelMediaDecoder.h"
namespace mozilla {
class MediaContainerType;
class WaveDecoder
class WaveDecoder : public ChannelMediaDecoder
{
public:
// MediaDecoder interface.
explicit WaveDecoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{
}
// Returns true if the Wave backend is pref'ed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsSupportedType(const MediaContainerType& aContainerType);
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
};
} // namespace mozilla

Просмотреть файл

@ -11,13 +11,14 @@
#include "mozilla/Assertions.h"
#include "mozilla/EndianUtils.h"
#include "mp4_demuxer/ByteReader.h"
#include "nsAutoPtr.h"
#include "VideoUtils.h"
#include "TimeUnits.h"
#include "prenv.h"
using mozilla::media::TimeUnit;
using mozilla::media::TimeIntervals;
using mp4_demuxer::ByteReader;
namespace mozilla {

Просмотреть файл

@ -5,12 +5,12 @@
#ifndef WAV_DEMUXER_H_
#define WAV_DEMUXER_H_
#include "mozilla/Attributes.h"
#include "mozilla/Maybe.h"
#include "MediaDataDemuxer.h"
#include "MediaResource.h"
#include "mp4_demuxer/ByteReader.h"
namespace mp4_demuxer {
class ByteReader;
}
using mp4_demuxer::ByteReader;
namespace mozilla {

Просмотреть файл

@ -4,12 +4,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebMDecoder.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_AV1
#include "AOMDecoder.h"
#endif
#include "MediaContainerType.h"
#include "MediaFormatReader.h"
#include "WebMDemuxer.h"
#include "WebMDecoder.h"
#include "VideoUtils.h"
namespace mozilla {
@ -55,5 +58,13 @@ WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
return true;
}
void
WebMDecoder::GetMozDebugReaderData(nsACString& aString)
{
if (mReader) {
mReader->GetMozDebugReaderData(aString);
}
}
} // namespace mozilla

Просмотреть файл

@ -6,19 +6,35 @@
#if !defined(WebMDecoder_h_)
#define WebMDecoder_h_
#include "ChannelMediaDecoder.h"
namespace mozilla {
class MediaContainerType;
class WebMDecoder
class WebMDecoder : public ChannelMediaDecoder
{
public:
explicit WebMDecoder(MediaDecoderInit& aInit)
: ChannelMediaDecoder(aInit)
{
}
// Returns true if aContainerType is a WebM type that we think we can render
// with an enabled platform decoder backend.
// If provided, codecs are checked for support.
static bool IsSupportedType(const MediaContainerType& aContainerType);
void GetMozDebugReaderData(nsACString& aString) override;
private:
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override
{
if (!IsWebMEnabled()) {
return nullptr;
}
return new WebMDecoder(aInit);
}
};
} // namespace mozilla

Просмотреть файл

@ -6,6 +6,7 @@
#define BYTE_READER_H_
#include "mozilla/EndianUtils.h"
#include "mozilla/Vector.h"
#include "nsTArray.h"
#include "MediaData.h"
@ -15,6 +16,10 @@ class MOZ_RAII ByteReader
{
public:
ByteReader() : mPtr(nullptr), mRemaining(0) {}
explicit ByteReader(const mozilla::Vector<uint8_t>& aData)
: mPtr(aData.begin()), mRemaining(aData.length()), mLength(aData.length())
{
}
ByteReader(const uint8_t* aData, size_t aSize)
: mPtr(aData), mRemaining(aSize), mLength(aSize)
{