summaryrefslogtreecommitdiffstats
path: root/dom/media/webcodecs/DecoderTypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webcodecs/DecoderTypes.h')
-rw-r--r--dom/media/webcodecs/DecoderTypes.h44
1 files changed, 31 insertions, 13 deletions
diff --git a/dom/media/webcodecs/DecoderTypes.h b/dom/media/webcodecs/DecoderTypes.h
index 339a164f70..4817a66f17 100644
--- a/dom/media/webcodecs/DecoderTypes.h
+++ b/dom/media/webcodecs/DecoderTypes.h
@@ -50,22 +50,22 @@ class VideoDecoderConfigInternal {
Maybe<uint32_t>&& aCodedHeight,
Maybe<uint32_t>&& aCodedWidth,
Maybe<VideoColorSpaceInternal>&& aColorSpace,
- Maybe<RefPtr<MediaByteBuffer>>&& aDescription,
+ already_AddRefed<MediaByteBuffer> aDescription,
Maybe<uint32_t>&& aDisplayAspectHeight,
Maybe<uint32_t>&& aDisplayAspectWidth,
const HardwareAcceleration& aHardwareAcceleration,
Maybe<bool>&& aOptimizeForLatency);
~VideoDecoderConfigInternal() = default;
- nsString ToString() const;
+ nsCString ToString() const;
bool Equals(const VideoDecoderConfigInternal& aOther) const {
- if (mDescription.isSome() != aOther.mDescription.isSome()) {
+ if (mDescription != aOther.mDescription) {
return false;
}
- if (mDescription.isSome() && aOther.mDescription.isSome()) {
- auto lhs = mDescription.value();
- auto rhs = aOther.mDescription.value();
+ if (mDescription && aOther.mDescription) {
+ auto lhs = mDescription;
+ auto rhs = aOther.mDescription;
if (lhs->Length() != rhs->Length()) {
return false;
}
@@ -86,7 +86,7 @@ class VideoDecoderConfigInternal {
Maybe<uint32_t> mCodedHeight;
Maybe<uint32_t> mCodedWidth;
Maybe<VideoColorSpaceInternal> mColorSpace;
- Maybe<RefPtr<MediaByteBuffer>> mDescription;
+ RefPtr<MediaByteBuffer> mDescription;
Maybe<uint32_t> mDisplayAspectHeight;
Maybe<uint32_t> mDisplayAspectWidth;
HardwareAcceleration mHardwareAcceleration;
@@ -116,24 +116,42 @@ class VideoDecoderTraits {
class AudioDecoderConfigInternal {
public:
+ AudioDecoderConfigInternal(const nsAString& aCodec, uint32_t aSampleRate,
+ uint32_t aNumberOfChannels,
+ already_AddRefed<MediaByteBuffer> aDescription);
static UniquePtr<AudioDecoderConfigInternal> Create(
const AudioDecoderConfig& aConfig);
~AudioDecoderConfigInternal() = default;
+ bool Equals(const AudioDecoderConfigInternal& aOther) const {
+ if (mDescription != aOther.mDescription) {
+ return false;
+ }
+ if (mDescription && aOther.mDescription) {
+ auto lhs = mDescription;
+ auto rhs = aOther.mDescription;
+ if (lhs->Length() != rhs->Length()) {
+ return false;
+ }
+ if (!ArrayEqual(lhs->Elements(), rhs->Elements(), lhs->Length())) {
+ return false;
+ }
+ }
+ return mCodec.Equals(aOther.mCodec) && mSampleRate == aOther.mSampleRate &&
+ mNumberOfChannels == aOther.mNumberOfChannels &&
+ mOptimizeForLatency == aOther.mOptimizeForLatency;
+ }
+ nsCString ToString() const;
+
nsString mCodec;
uint32_t mSampleRate;
uint32_t mNumberOfChannels;
- Maybe<RefPtr<MediaByteBuffer>> mDescription;
+ RefPtr<MediaByteBuffer> mDescription;
// Compilation fix, should be abstracted by DecoderAgent since those are not
// supported
HardwareAcceleration mHardwareAcceleration =
HardwareAcceleration::No_preference;
Maybe<bool> mOptimizeForLatency;
-
- private:
- AudioDecoderConfigInternal(const nsAString& aCodec, uint32_t aSampleRate,
- uint32_t aNumberOfChannels,
- Maybe<RefPtr<MediaByteBuffer>>&& aDescription);
};
class AudioDecoderTraits {