diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /dom/media/webcodecs/DecoderTypes.h | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webcodecs/DecoderTypes.h')
-rw-r--r-- | dom/media/webcodecs/DecoderTypes.h | 44 |
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 { |