author | Chris Pearce <cpearce@mozilla.com> |
Tue, 29 Aug 2017 14:00:33 +1200 | |
changeset 377385 | 19c91c598eed05c98d0b11c484dbd4fbbe8bddad |
parent 377384 | 859bd485c707cf5daee7cf4899bd3306aebd6d3f |
child 377386 | 9d5100d775fbc0c06bddb9001eeeaf1dc47603fa |
push id | 32407 |
push user | archaeopteryx@coole-files.de |
push date | Tue, 29 Aug 2017 18:28:36 +0000 |
treeherder | mozilla-central@d814f791de3b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jwwang |
bugs | 1394648 |
milestone | 57.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -19,17 +19,16 @@ #include "mozilla/ClearOnShutdown.h" #include "mozilla/Preferences.h" #include "mozilla/SharedThreadPool.h" #include "mozilla/SyncRunnable.h" #include "mozilla/Telemetry.h" #include "mozilla/Unused.h" #include "nsContentUtils.h" #include "nsPrintfCString.h" -#include "nsSize.h" #include <algorithm> #include <queue> using namespace mozilla::media; using mozilla::layers::Image; using mozilla::layers::LayerManager;
--- a/dom/media/MediaInfo.h +++ b/dom/media/MediaInfo.h @@ -2,26 +2,26 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * 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/. */ #if !defined(MediaInfo_h) #define MediaInfo_h #include "mozilla/UniquePtr.h" -#include "nsRect.h" #include "mozilla/RefPtr.h" #include "nsDataHashtable.h" -#include "nsSize.h" #include "nsString.h" #include "nsTArray.h" #include "ImageTypes.h" #include "MediaData.h" #include "StreamTracks.h" // for TrackID #include "TimeUnits.h" +#include "mozilla/gfx/Point.h" // for gfx::IntSize +#include "mozilla/gfx/Rect.h" // for gfx::IntRect namespace mozilla { class AudioInfo; class VideoInfo; class TextInfo; class MetadataTag @@ -194,30 +194,35 @@ public: kDegree_270 = 270, }; VideoInfo() : VideoInfo(-1, -1) { } explicit VideoInfo(int32_t aWidth, int32_t aHeight) - : VideoInfo(nsIntSize(aWidth, aHeight)) + : VideoInfo(gfx::IntSize(aWidth, aHeight)) { } - explicit VideoInfo(const nsIntSize& aSize) - : TrackInfo(kVideoTrack, NS_LITERAL_STRING("2"), NS_LITERAL_STRING("main"), - EmptyString(), EmptyString(), true, 2) + explicit VideoInfo(const gfx::IntSize& aSize) + : TrackInfo(kVideoTrack, + NS_LITERAL_STRING("2"), + NS_LITERAL_STRING("main"), + EmptyString(), + EmptyString(), + true, + 2) , mDisplay(aSize) , mStereoMode(StereoMode::MONO) , mImage(aSize) , mCodecSpecificConfig(new MediaByteBuffer) , mExtraData(new MediaByteBuffer) , mRotation(kDegree_0) - , mImageRect(nsIntRect(nsIntPoint(), aSize)) + , mImageRect(gfx::IntRect(gfx::IntPoint(), aSize)) { } VideoInfo(const VideoInfo& aOther) : TrackInfo(aOther) , mDisplay(aOther.mDisplay) , mStereoMode(aOther.mStereoMode) , mImage(aOther.mImage) @@ -254,45 +259,42 @@ public: mAlphaPresent = aAlphaPresent; } bool HasAlpha() const { return mAlphaPresent; } - nsIntRect ImageRect() const + gfx::IntRect ImageRect() const { if (mImageRect.Width() < 0 || mImageRect.Height() < 0) { - return nsIntRect(0, 0, mImage.width, mImage.height); + return gfx::IntRect(0, 0, mImage.width, mImage.height); } return mImageRect; } - void SetImageRect(const nsIntRect& aRect) - { - mImageRect = aRect; - } + void SetImageRect(const gfx::IntRect& aRect) { mImageRect = aRect; } // Returned the crop rectangle scaled to aWidth/aHeight size relative to // mImage size. // If aWidth and aHeight are identical to the original mImage.width/mImage.height // then the scaling ratio will be 1. // This is used for when the frame size is different from what the container // reports. This is legal in WebM, and we will preserve the ratio of the crop // rectangle as it was reported relative to the picture size reported by the // container. - nsIntRect ScaledImageRect(int64_t aWidth, int64_t aHeight) const + gfx::IntRect ScaledImageRect(int64_t aWidth, int64_t aHeight) const { if ((aWidth == mImage.width && aHeight == mImage.height) || !mImage.width || !mImage.height) { return ImageRect(); } - nsIntRect imageRect = ImageRect(); + gfx::IntRect imageRect = ImageRect(); imageRect.x = (imageRect.x * aWidth) / mImage.width; imageRect.y = (imageRect.y * aHeight) / mImage.height; imageRect.SetWidth((aWidth * imageRect.Width()) / mImage.width); imageRect.SetHeight((aHeight * imageRect.Height()) / mImage.height); return imageRect; } Rotation ToSupportedRotation(int32_t aDegree) @@ -307,35 +309,35 @@ public: default: NS_WARNING_ASSERTION(aDegree == 0, "Invalid rotation degree, ignored"); return kDegree_0; } } // Size in pixels at which the video is rendered. This is after it has // been scaled by its aspect ratio. - nsIntSize mDisplay; + gfx::IntSize mDisplay; // Indicates the frame layout for single track stereo videos. StereoMode mStereoMode; // Size of the decoded video's image. - nsIntSize mImage; + gfx::IntSize mImage; RefPtr<MediaByteBuffer> mCodecSpecificConfig; RefPtr<MediaByteBuffer> mExtraData; // Describing how many degrees video frames should be rotated in clock-wise to // get correct view. Rotation mRotation; private: // mImage may be cropped; currently only used with the WebM container. // A negative width or height indicate that no cropping is to occur. - nsIntRect mImageRect; + gfx::IntRect mImageRect; // Indicates whether or not frames may contain alpha information. bool mAlphaPresent = false; }; class AudioInfo : public TrackInfo { public: @@ -472,17 +474,17 @@ public: void EnableVideo() { if (HasVideo()) { return; } // Set dummy values so that HasVideo() will return true; // See VideoInfo::IsValid() - mVideo.mDisplay = nsIntSize(1, 1); + mVideo.mDisplay = gfx::IntSize(1, 1); } bool HasAudio() const { return mAudio.IsValid(); } void EnableAudio()
--- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -16,17 +16,16 @@ #include "mozilla/Telemetry.h" #include "nsCharSeparatedTokenizer.h" #include "nsContentTypeParser.h" #include "nsIConsoleService.h" #include "nsIRandomGenerator.h" #include "nsIServiceManager.h" #include "nsMathUtils.h" #include "nsServiceManagerUtils.h" -#include "nsSize.h" #include "nsThreadUtils.h" #include <functional> #include <stdint.h> namespace mozilla { NS_NAMED_LITERAL_CSTRING(kEMEKeySystemClearkey, "org.w3.clearkey"); @@ -76,17 +75,18 @@ nsresult SecondsToUsecs(double aSeconds, static int32_t ConditionDimension(float aValue) { // This will exclude NaNs and too-big values. if (aValue > 1.0 && aValue <= INT32_MAX) return int32_t(NS_round(aValue)); return 0; } -void ScaleDisplayByAspectRatio(nsIntSize& aDisplay, float aAspectRatio) +void +ScaleDisplayByAspectRatio(gfx::IntSize& aDisplay, float aAspectRatio) { if (aAspectRatio > 1.0) { // Increase the intrinsic width aDisplay.width = ConditionDimension(aAspectRatio * aDisplay.width); } else { // Increase the intrinsic height aDisplay.height = ConditionDimension(aDisplay.height / aAspectRatio); } @@ -166,18 +166,19 @@ IsVideoContentType(const nsCString& aCon NS_NAMED_LITERAL_CSTRING(video, "video"); if (FindInReadable(video, aContentType)) { return true; } return false; } bool -IsValidVideoRegion(const nsIntSize& aFrame, const nsIntRect& aPicture, - const nsIntSize& aDisplay) +IsValidVideoRegion(const gfx::IntSize& aFrame, + const gfx::IntRect& aPicture, + const gfx::IntSize& aDisplay) { return aFrame.width <= PlanarYCbCrImage::MAX_DIMENSION && aFrame.height <= PlanarYCbCrImage::MAX_DIMENSION && aFrame.width * aFrame.height <= MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT && aFrame.width * aFrame.height != 0 && aPicture.width <= PlanarYCbCrImage::MAX_DIMENSION && aPicture.x < PlanarYCbCrImage::MAX_DIMENSION &&
--- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -6,30 +6,30 @@ #ifndef VideoUtils_h #define VideoUtils_h #include "AudioSampleFormat.h" #include "MediaInfo.h" #include "TimeUnits.h" #include "VideoLimits.h" +#include "mozilla/gfx/Point.h" // for gfx::IntSize #include "mozilla/AbstractThread.h" #include "mozilla/Attributes.h" #include "mozilla/CheckedInt.h" #include "mozilla/MozPromise.h" #include "mozilla/ReentrantMonitor.h" #include "mozilla/RefPtr.h" #include "mozilla/UniquePtr.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsINamed.h" #include "nsIThread.h" #include "nsITimer.h" -#include "nsRect.h" -#include "nsSize.h" + #include "nsThreadUtils.h" #include "prtime.h" using mozilla::CheckedInt64; using mozilla::CheckedUint64; using mozilla::CheckedInt32; using mozilla::CheckedUint32; @@ -144,31 +144,34 @@ CheckedInt64 TimeUnitToFrames(const medi // Converts from seconds to microseconds. Returns failure if the resulting // integer is too big to fit in an int64_t. nsresult SecondsToUsecs(double aSeconds, int64_t& aOutUsecs); // Scales the display rect aDisplay by aspect ratio aAspectRatio. // Note that aDisplay must be validated by IsValidVideoRegion() // before being used! -void ScaleDisplayByAspectRatio(nsIntSize& aDisplay, float aAspectRatio); +void +ScaleDisplayByAspectRatio(gfx::IntSize& aDisplay, float aAspectRatio); // Downmix Stereo audio samples to Mono. // Input are the buffer contains stereo data and the number of frames. void DownmixStereoToMono(mozilla::AudioDataValue* aBuffer, uint32_t aFrames); bool IsVideoContentType(const nsCString& aContentType); // Returns true if it's safe to use aPicture as the picture to be // extracted inside a frame of size aFrame, and scaled up to and displayed // at a size of aDisplay. You should validate the frame, picture, and // display regions before using them to display video frames. -bool IsValidVideoRegion(const nsIntSize& aFrame, const nsIntRect& aPicture, - const nsIntSize& aDisplay); +bool +IsValidVideoRegion(const gfx::IntSize& aFrame, + const gfx::IntRect& aPicture, + const gfx::IntSize& aDisplay); // Template to automatically set a variable to a value on scope exit. // Useful for unsetting flags, etc. template<typename T> class AutoSetOnScopeExit { public: AutoSetOnScopeExit(T& aVar, T aValue) : mVar(aVar)
--- a/dom/media/ipc/MediaIPCUtils.h +++ b/dom/media/ipc/MediaIPCUtils.h @@ -3,16 +3,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * 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/. */ #ifndef mozilla_dom_media_MediaIPCUtils_h #define mozilla_dom_media_MediaIPCUtils_h #include "ipc/IPCMessageUtils.h" +#include "mozilla/gfx/Rect.h" #include "mozilla/GfxMessageUtils.h" #include "PlatformDecoderModule.h" namespace IPC { template<> struct ParamTraits<mozilla::VideoInfo> { typedef mozilla::VideoInfo paramType; @@ -26,17 +27,17 @@ namespace IPC { WriteParam(aMsg, aParam.mDisplay); WriteParam(aMsg, aParam.mStereoMode); WriteParam(aMsg, aParam.mImage); WriteParam(aMsg, aParam.ImageRect()); } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { - nsIntRect imageRect; + mozilla::gfx::IntRect imageRect; if (ReadParam(aMsg, aIter, &aResult->mMimeType) && ReadParam(aMsg, aIter, &aResult->mDisplay) && ReadParam(aMsg, aIter, &aResult->mStereoMode) && ReadParam(aMsg, aIter, &aResult->mImage) && ReadParam(aMsg, aIter, &imageRect)) { aResult->SetImageRect(imageRect); return true; }
--- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -345,20 +345,22 @@ TheoraState::Init() int64_t n = mTheoraInfo.aspect_numerator; int64_t d = mTheoraInfo.aspect_denominator; float aspectRatio = (n == 0 || d == 0) ? 1.0f : static_cast<float>(n) / static_cast<float>(d); // Ensure the frame and picture regions aren't larger than our prescribed // maximum, or zero sized. - nsIntSize frame(mTheoraInfo.frame_width, mTheoraInfo.frame_height); - nsIntRect picture(mTheoraInfo.pic_x, mTheoraInfo.pic_y, - mTheoraInfo.pic_width, mTheoraInfo.pic_height); - nsIntSize display(mTheoraInfo.pic_width, mTheoraInfo.pic_height); + gfx::IntSize frame(mTheoraInfo.frame_width, mTheoraInfo.frame_height); + gfx::IntRect picture(mTheoraInfo.pic_x, + mTheoraInfo.pic_y, + mTheoraInfo.pic_width, + mTheoraInfo.pic_height); + gfx::IntSize display(mTheoraInfo.pic_width, mTheoraInfo.pic_height); ScaleDisplayByAspectRatio(display, aspectRatio); if (!IsValidVideoRegion(frame, picture, display)) { return mActive = false; } mCtx = th_decode_alloc(&mTheoraInfo, mSetup); if (!mCtx) { return mActive = false;
--- a/dom/media/ogg/OggDemuxer.h +++ b/dom/media/ogg/OggDemuxer.h @@ -304,17 +304,17 @@ private: } bool HaveStartTime () const; bool HaveStartTime (TrackInfo::TrackType aType); int64_t StartTime() const; int64_t StartTime(TrackInfo::TrackType aType); // The picture region inside Theora frame to be displayed, if we have // a Theora video track. - nsIntRect mPicture; + gfx::IntRect mPicture; // True if we are decoding a chained ogg. bool mIsChained; // Total audio duration played so far. media::TimeUnit mDecodedAudioDuration; // Events manager
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp +++ b/dom/media/platforms/agnostic/AOMDecoder.cpp @@ -340,26 +340,27 @@ AOMDecoder::IsKeyframe(Span<const uint8_ LOG_RESULT(res, "couldn't get keyframe flag with aom_codec_peek_stream_info"); return false; } return bool(info.is_kf); } /* static */ -nsIntSize -AOMDecoder::GetFrameSize(Span<const uint8_t> aBuffer) { +gfx::IntSize +AOMDecoder::GetFrameSize(Span<const uint8_t> aBuffer) +{ aom_codec_stream_info_t info; PodZero(&info); auto res = aom_codec_peek_stream_info(aom_codec_av1_dx(), aBuffer.Elements(), aBuffer.Length(), &info); if (res != AOM_CODEC_OK) { LOG_RESULT(res, "couldn't get frame size with aom_codec_peek_stream_info"); } - return nsIntSize(info.w, info.h); + return gfx::IntSize(info.w, info.h); } } // namespace mozilla #undef LOG
--- a/dom/media/platforms/agnostic/AOMDecoder.h +++ b/dom/media/platforms/agnostic/AOMDecoder.h @@ -35,17 +35,17 @@ public: // Return true if aCodecType is a supported codec description. static bool IsSupportedCodec(const nsAString& aCodecType); // Return true if a sample is a keyframe. static bool IsKeyframe(Span<const uint8_t> aBuffer); // Return the frame dimensions for a sample. - static nsIntSize GetFrameSize(Span<const uint8_t> aBuffer); + static gfx::IntSize GetFrameSize(Span<const uint8_t> aBuffer); private: ~AOMDecoder(); RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample); const RefPtr<layers::ImageContainer> mImageContainer; const RefPtr<TaskQueue> mTaskQueue;
--- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp +++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp @@ -4,33 +4,33 @@ * 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 "BlankDecoderModule.h" #include "mozilla/CheckedInt.h" #include "mozilla/UniquePtrExtensions.h" #include "mozilla/RefPtr.h" -#include "nsRect.h" -#include "nsSize.h" +#include "mozilla/gfx/Rect.h" +#include "mozilla/gfx/Point.h" #include "ImageContainer.h" #include "MediaData.h" #include "MediaInfo.h" #include "VideoUtils.h" namespace mozilla { BlankVideoDataCreator::BlankVideoDataCreator(uint32_t aFrameWidth, uint32_t aFrameHeight, layers::ImageContainer* aImageContainer) : mFrameWidth(aFrameWidth) , mFrameHeight(aFrameHeight) , mImageContainer(aImageContainer) { - mInfo.mDisplay = nsIntSize(mFrameWidth, mFrameHeight); + mInfo.mDisplay = gfx::IntSize(mFrameWidth, mFrameHeight); mPicture = gfx::IntRect(0, 0, mFrameWidth, mFrameHeight); } already_AddRefed<MediaData> BlankVideoDataCreator::Create(MediaRawData* aSample) { // Create a fake YUV buffer in a 420 format. That is, an 8bpp Y plane, // with a U and V plane that are half the size of the Y plane, i.e 8 bit,
--- a/dom/media/platforms/agnostic/VPXDecoder.cpp +++ b/dom/media/platforms/agnostic/VPXDecoder.cpp @@ -324,25 +324,25 @@ VPXDecoder::IsKeyframe(Span<const uint8_ vpx_codec_peek_stream_info(vpx_codec_vp9_dx(), aBuffer.Elements(), aBuffer.Length(), &si); return bool(si.is_kf); } return false; } /* static */ -nsIntSize +gfx::IntSize VPXDecoder::GetFrameSize(Span<const uint8_t> aBuffer, Codec aCodec) { vpx_codec_stream_info_t si; PodZero(&si); si.sz = sizeof(si); if (aCodec == Codec::VP8) { vpx_codec_peek_stream_info(vpx_codec_vp8_dx(), aBuffer.Elements(), aBuffer.Length(), &si); } else if (aCodec == Codec::VP9) { vpx_codec_peek_stream_info(vpx_codec_vp9_dx(), aBuffer.Elements(), aBuffer.Length(), &si); } - return nsIntSize(si.w, si.h); + return gfx::IntSize(si.w, si.h); } } // namespace mozilla #undef LOG
--- a/dom/media/platforms/agnostic/VPXDecoder.h +++ b/dom/media/platforms/agnostic/VPXDecoder.h @@ -45,17 +45,17 @@ public: static bool IsVPX(const nsACString& aMimeType, uint8_t aCodecMask=VP8|VP9); static bool IsVP8(const nsACString& aMimeType); static bool IsVP9(const nsACString& aMimeType); // Return true if a sample is a keyframe for the specified codec. static bool IsKeyframe(Span<const uint8_t> aBuffer, Codec aCodec); // Return the frame dimensions for a sample for the specified codec. - static nsIntSize GetFrameSize(Span<const uint8_t> aBuffer, Codec aCodec); + static gfx::IntSize GetFrameSize(Span<const uint8_t> aBuffer, Codec aCodec); private: ~VPXDecoder(); RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample); MediaResult DecodeAlpha(vpx_image_t** aImgAlpha, const MediaRawData* aSample); const RefPtr<layers::ImageContainer> mImageContainer; RefPtr<layers::KnowsCompositor> mImageAllocator;
--- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -346,17 +346,17 @@ AppleVTDecoder::OutputFrame(CVPixelBuffe mSeekTargetThreshold.reset(); } } // Where our resulting image will end up. RefPtr<MediaData> data; // Bounds. VideoInfo info; - info.mDisplay = nsIntSize(mDisplayWidth, mDisplayHeight); + info.mDisplay = gfx::IntSize(mDisplayWidth, mDisplayHeight); if (useNullSample) { data = new NullData(aFrameRef.byte_offset, aFrameRef.composition_timestamp, aFrameRef.duration); } else if (mUseSoftwareImages) { size_t width = CVPixelBufferGetWidth(aImage); size_t height = CVPixelBufferGetHeight(aImage);
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -99,17 +99,17 @@ public: HRESULT Init(layers::KnowsCompositor* aKnowsCompositor, nsACString& aFailureReason); IUnknown* GetDXVADeviceManager() override; // Copies a region (aRegion) of the video frame stored in aVideoSample // into an image which is returned by aOutImage. HRESULT CopyToImage(IMFSample* aVideoSample, - const nsIntRect& aRegion, + const gfx::IntRect& aRegion, Image** aOutImage) override; bool SupportsConfig(IMFMediaType* aType, float aFramerate) override; bool CreateDXVA2Decoder(const VideoInfo& aVideoInfo, nsACString& aFailureReason) override; private: @@ -434,17 +434,17 @@ D3D9DXVA2Manager::Init(layers::KnowsComp reporter.SetSuccessful(); return S_OK; } HRESULT D3D9DXVA2Manager::CopyToImage(IMFSample* aSample, - const nsIntRect& aRegion, + const gfx::IntRect& aRegion, Image** aOutImage) { RefPtr<IMFMediaBuffer> buffer; HRESULT hr = aSample->GetBufferByIndex(0, getter_AddRefs(buffer)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); RefPtr<IDirect3DSurface9> surface; hr = wmf::MFGetService(buffer, @@ -606,17 +606,17 @@ public: nsACString& aFailureReason, ID3D11Device* aDevice); IUnknown* GetDXVADeviceManager() override; // Copies a region (aRegion) of the video frame stored in aVideoSample // into an image which is returned by aOutImage. HRESULT CopyToImage(IMFSample* aVideoSample, - const nsIntRect& aRegion, + const gfx::IntRect& aRegion, Image** aOutImage) override; virtual HRESULT CopyToBGRATexture(ID3D11Texture2D *aInTexture, ID3D11Texture2D** aOutTexture); HRESULT ConfigureForSize(uint32_t aWidth, uint32_t aHeight) override; bool IsD3D11() override { return true; } @@ -903,17 +903,17 @@ D3D11DXVA2Manager::CreateOutputSample(Re NS_ENSURE_TRUE(SUCCEEDED(hr), hr); aSample = sample; return S_OK; } HRESULT D3D11DXVA2Manager::CopyToImage(IMFSample* aVideoSample, - const nsIntRect& aRegion, + const gfx::IntRect& aRegion, Image** aOutImage) { NS_ENSURE_TRUE(aVideoSample, E_POINTER); NS_ENSURE_TRUE(aOutImage, E_POINTER); MOZ_ASSERT(mTextureClientAllocator); RefPtr<D3D11ShareHandleImage> image = new D3D11ShareHandleImage(gfx::IntSize(mWidth, mHeight), aRegion);
--- a/dom/media/platforms/wmf/DXVA2Manager.h +++ b/dom/media/platforms/wmf/DXVA2Manager.h @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #if !defined(DXVA2Manager_h_) #define DXVA2Manager_h_ #include "MediaInfo.h" #include "WMF.h" #include "mozilla/Mutex.h" #include "nsAutoPtr.h" -#include "nsRect.h" +#include "mozilla/gfx/Rect.h" #include "d3d11.h" namespace mozilla { namespace layers { class Image; class ImageContainer; class KnowsCompositor; @@ -38,17 +38,17 @@ public: // Returns a pointer to the D3D device manager responsible for managing the // device we're using for hardware accelerated video decoding. If we're using // D3D9Ex, this is an IDirect3DDeviceManager9. For D3D11 this is an // IMFDXGIDeviceManager. It is safe to call this on any thread. virtual IUnknown* GetDXVADeviceManager() = 0; // Creates an Image for the video frame stored in aVideoSample. virtual HRESULT CopyToImage(IMFSample* aVideoSample, - const nsIntRect& aRegion, + const gfx::IntRect& aRegion, layers::Image** aOutImage) = 0; virtual HRESULT CopyToBGRATexture(ID3D11Texture2D *aInTexture, ID3D11Texture2D** aOutTexture) { // Not implemented! MOZ_CRASH("CopyToBGRATexture not implemented on this manager."); return E_FAIL;
--- a/dom/media/platforms/wmf/WMFUtils.cpp +++ b/dom/media/platforms/wmf/WMFUtils.cpp @@ -88,17 +88,17 @@ GetSampleTime(IMFSample* aSample) HRESULT hr = aSample->GetSampleTime(×tampHns); NS_ENSURE_TRUE(SUCCEEDED(hr), TimeUnit::Invalid()); return TimeUnit::FromMicroseconds(HNsToUsecs(timestampHns)); } // Gets the sub-region of the video frame that should be displayed. // See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb530115(v=vs.85).aspx HRESULT -GetPictureRegion(IMFMediaType* aMediaType, nsIntRect& aOutPictureRegion) +GetPictureRegion(IMFMediaType* aMediaType, gfx::IntRect& aOutPictureRegion) { // Determine if "pan and scan" is enabled for this media. If it is, we // only display a region of the video frame, not the entire frame. BOOL panScan = MFGetAttributeUINT32(aMediaType, MF_MT_PAN_SCAN_ENABLED, FALSE); // If pan and scan mode is enabled. Try to get the display region. HRESULT hr = E_FAIL; @@ -126,31 +126,31 @@ GetPictureRegion(IMFMediaType* aMediaTyp hr = aMediaType->GetBlob(MF_MT_GEOMETRIC_APERTURE, (UINT8*)&videoArea, sizeof(MFVideoArea), nullptr); } if (SUCCEEDED(hr)) { // The media specified a picture region, return it. - aOutPictureRegion = nsIntRect(MFOffsetToInt32(videoArea.OffsetX), - MFOffsetToInt32(videoArea.OffsetY), - videoArea.Area.cx, - videoArea.Area.cy); + aOutPictureRegion = gfx::IntRect(MFOffsetToInt32(videoArea.OffsetX), + MFOffsetToInt32(videoArea.OffsetY), + videoArea.Area.cx, + videoArea.Area.cy); return S_OK; } // No picture region defined, fall back to using the entire video area. UINT32 width = 0, height = 0; hr = MFGetAttributeSize(aMediaType, MF_MT_FRAME_SIZE, &width, &height); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); NS_ENSURE_TRUE(width <= MAX_VIDEO_WIDTH, E_FAIL); NS_ENSURE_TRUE(height <= MAX_VIDEO_HEIGHT, E_FAIL); - aOutPictureRegion = nsIntRect(0, 0, width, height); + aOutPictureRegion = gfx::IntRect(0, 0, width, height); return S_OK; } nsString GetProgramW6432Path() { char* programPath = PR_GetEnvSecure("ProgramW6432"); if (!programPath) {
--- a/dom/media/platforms/wmf/WMFUtils.h +++ b/dom/media/platforms/wmf/WMFUtils.h @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef WMFUtils_h #define WMFUtils_h #include "TimeUnits.h" #include "VideoUtils.h" #include "WMF.h" -#include "nsRect.h" +#include "mozilla/gfx/Rect.h" #include "nsString.h" // Various utilities shared by WMF backend files. namespace mozilla { // Converts from microseconds to hundreds of nanoseconds. // We use microseconds for our timestamps, whereas WMF uses @@ -40,17 +40,17 @@ HRESULT HNsToFrames(int64_t aHNs, uint32 HRESULT GetDefaultStride(IMFMediaType* aType, uint32_t aWidth, uint32_t* aOutStride); int32_t MFOffsetToInt32(const MFOffset& aOffset); // Gets the sub-region of the video frame that should be displayed. // See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb530115(v=vs.85).aspx HRESULT -GetPictureRegion(IMFMediaType* aMediaType, nsIntRect& aOutPictureRegion); +GetPictureRegion(IMFMediaType* aMediaType, gfx::IntRect& aOutPictureRegion); // Returns the duration of a IMFSample in TimeUnit. // Returns media::TimeUnit::Invalid() on failure. media::TimeUnit GetSampleDuration(IMFSample* aSample); // Returns the presentation time of a IMFSample in TimeUnit. // Returns media::TimeUnit::Invalid() on failure. media::TimeUnit GetSampleTime(IMFSample* aSample);
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -915,17 +915,18 @@ WMFVideoMFTManager::CreateBasicVideoFram b.mPlanes[2].mWidth = halfWidth; b.mPlanes[2].mOffset = 0; b.mPlanes[2].mSkip = 0; TimeUnit pts = GetSampleTime(aSample); NS_ENSURE_TRUE(pts.IsValid(), E_FAIL); TimeUnit duration = GetSampleDuration(aSample); NS_ENSURE_TRUE(duration.IsValid(), E_FAIL); - nsIntRect pictureRegion = mVideoInfo.ScaledImageRect(videoWidth, videoHeight); + gfx::IntRect pictureRegion = + mVideoInfo.ScaledImageRect(videoWidth, videoHeight); LayersBackend backend = GetCompositorBackendType(mKnowsCompositor); if (backend != LayersBackend::LAYERS_D3D11 || !mIMFUsable) { RefPtr<VideoData> v = VideoData::CreateAndCopyData(mVideoInfo, mImageContainer, aStreamOffset, pts, @@ -973,17 +974,17 @@ WMFVideoMFTManager::CreateD3DVideoFrame( NS_ENSURE_TRUE(aSample, E_POINTER); NS_ENSURE_TRUE(aOutVideoData, E_POINTER); NS_ENSURE_TRUE(mDXVA2Manager, E_ABORT); NS_ENSURE_TRUE(mUseHwAccel, E_ABORT); *aOutVideoData = nullptr; HRESULT hr; - nsIntRect pictureRegion = + gfx::IntRect pictureRegion = mVideoInfo.ScaledImageRect(mImageSize.width, mImageSize.height); RefPtr<Image> image; hr = mDXVA2Manager->CopyToImage(aSample, pictureRegion, getter_AddRefs(image)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); NS_ENSURE_TRUE(image, E_FAIL);
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.h +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.h @@ -8,17 +8,17 @@ #define WMFVideoMFTManager_h_ #include "MFTDecoder.h" #include "WMF.h" #include "WMFMediaDataDecoder.h" #include "mozilla/Atomics.h" #include "mozilla/RefPtr.h" #include "nsAutoPtr.h" -#include "nsRect.h" +#include "mozilla/gfx/Rect.h" namespace mozilla { class DXVA2Manager; class WMFVideoMFTManager : public MFTManager { public: @@ -88,17 +88,17 @@ private: HRESULT SetDecoderMediaTypes(); bool CanUseDXVA(IMFMediaType* aType); already_AddRefed<MFTDecoder> LoadAMDVP9Decoder(); // Video frame geometry. const VideoInfo mVideoInfo; - const nsIntSize mImageSize; + const gfx::IntSize mImageSize; uint32_t mVideoStride; RefPtr<layers::ImageContainer> mImageContainer; RefPtr<layers::KnowsCompositor> mKnowsCompositor; nsAutoPtr<DXVA2Manager> mDXVA2Manager; media::TimeUnit mLastDuration; media::TimeUnit mLastTime;
--- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -334,36 +334,36 @@ WebMDemuxer::ReadMetadata() default: NS_WARNING("Unknown WebM video codec"); return NS_ERROR_FAILURE; } // Picture region, taking into account cropping, before scaling // to the display size. unsigned int cropH = params.crop_right + params.crop_left; unsigned int cropV = params.crop_bottom + params.crop_top; - nsIntRect pictureRect(params.crop_left, - params.crop_top, - params.width - cropH, - params.height - cropV); + gfx::IntRect pictureRect(params.crop_left, + params.crop_top, + params.width - cropH, + params.height - cropV); // If the cropping data appears invalid then use the frame data if (pictureRect.width <= 0 || pictureRect.height <= 0 || pictureRect.x < 0 || pictureRect.y < 0) { pictureRect.x = 0; pictureRect.y = 0; pictureRect.width = params.width; pictureRect.height = params.height; } // Validate the container-reported frame and pictureRect sizes. This // ensures that our video frame creation code doesn't overflow. - nsIntSize displaySize(params.display_width, params.display_height); - nsIntSize frameSize(params.width, params.height); + gfx::IntSize displaySize(params.display_width, params.display_height); + gfx::IntSize frameSize(params.width, params.height); if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) { // Video track's frame sizes will overflow. Ignore the video track. continue; } mVideoTrack = track; mHasVideo = true; @@ -693,17 +693,17 @@ WebMDemuxer::GetNextPacket(TrackInfo::Tr #endif default: NS_WARNING("Cannot detect keyframes in unknown WebM video codec"); return NS_ERROR_FAILURE; } if (isKeyframe) { // For both VP8 and VP9, we only look for resolution changes // on keyframes. Other resolution changes are invalid. - auto dimensions = nsIntSize(0, 0); + auto dimensions = gfx::IntSize(0, 0); switch (mVideoCodec) { case NESTEGG_CODEC_VP8: dimensions = VPXDecoder::GetFrameSize(sample, VPXDecoder::Codec::VP8); break; case NESTEGG_CODEC_VP9: dimensions = VPXDecoder::GetFrameSize(sample, VPXDecoder::Codec::VP9); break; #ifdef MOZ_AV1
--- a/dom/media/webm/WebMDemuxer.h +++ b/dom/media/webm/WebMDemuxer.h @@ -256,17 +256,17 @@ private: bool mNeedReIndex; // The last complete block parsed by the WebMBufferedState. -1 if not set. // We cache those values rather than retrieving them for performance reasons // as nestegg only performs 1-byte read at a time. int64_t mLastWebMBlockOffset; const bool mIsMediaSource; - Maybe<nsIntSize> mLastSeenFrameSize; + Maybe<gfx::IntSize> mLastSeenFrameSize; // This will be populated only if a resolution change occurs, otherwise it // will be left as null so the original metadata is used RefPtr<TrackInfoSharedPtr> mSharedVideoTrackInfo; EncryptionInfo mCrypto; }; class WebMTrackDemuxer : public MediaTrackDemuxer