From 59d9de38de236335be4fad1150881119471db0bc Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 9 Feb 2014 09:04:38 +0100 Subject: [PATCH] Bug 952033 - Part e: Use IntSize in VideoSegment; r=roc --- content/media/MediaDecoderStateMachine.cpp | 2 +- content/media/VideoSegment.cpp | 6 ++++-- content/media/VideoSegment.h | 3 ++- content/media/encoder/TrackEncoder.cpp | 2 +- content/media/webrtc/MediaEngineDefault.cpp | 4 ++-- content/media/webrtc/MediaEngineTabVideoSource.cpp | 4 ++-- content/media/webrtc/MediaEngineWebRTCVideo.cpp | 4 ++-- media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp | 3 +-- .../signaling/src/peerconnection/PeerConnectionMedia.h | 3 ++- 9 files changed, 17 insertions(+), 14 deletions(-) diff --git a/content/media/MediaDecoderStateMachine.cpp b/content/media/MediaDecoderStateMachine.cpp index 6c045ebb737d..275fd27401c0 100644 --- a/content/media/MediaDecoderStateMachine.cpp +++ b/content/media/MediaDecoderStateMachine.cpp @@ -620,7 +620,7 @@ static void WriteVideoToMediaStream(layers::Image* aImage, VideoSegment* aOutput) { nsRefPtr image = aImage; - aOutput->AppendFrame(image.forget(), aDuration, ThebesIntSize(aIntrinsicSize)); + aOutput->AppendFrame(image.forget(), aDuration, aIntrinsicSize); } static const TrackID TRACK_AUDIO = 1; diff --git a/content/media/VideoSegment.cpp b/content/media/VideoSegment.cpp index 5e0df4063c82..d61d1d8a459f 100644 --- a/content/media/VideoSegment.cpp +++ b/content/media/VideoSegment.cpp @@ -4,6 +4,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "VideoSegment.h" + +#include "gfx2DGlue.h" #include "ImageContainer.h" namespace mozilla { @@ -43,10 +45,10 @@ VideoChunk::~VideoChunk() void VideoSegment::AppendFrame(already_AddRefed aImage, TrackTicks aDuration, - const gfxIntSize& aIntrinsicSize) + const IntSize& aIntrinsicSize) { VideoChunk* chunk = AppendChunk(aDuration); - VideoFrame frame(aImage, aIntrinsicSize); + VideoFrame frame(aImage, ThebesIntSize(aIntrinsicSize)); chunk->mFrame.TakeFrom(&frame); } diff --git a/content/media/VideoSegment.h b/content/media/VideoSegment.h index 10d7e1f7d85b..0f97af3d3bf8 100644 --- a/content/media/VideoSegment.h +++ b/content/media/VideoSegment.h @@ -84,12 +84,13 @@ struct VideoChunk { class VideoSegment : public MediaSegmentBase { public: typedef mozilla::layers::Image Image; + typedef mozilla::gfx::IntSize IntSize; VideoSegment(); ~VideoSegment(); void AppendFrame(already_AddRefed aImage, TrackTicks aDuration, - const gfxIntSize& aIntrinsicSize); + const IntSize& aIntrinsicSize); const VideoFrame* GetFrameAt(TrackTicks aOffset, TrackTicks* aStart = nullptr) { VideoChunk* c = FindChunkContaining(aOffset, aStart); diff --git a/content/media/encoder/TrackEncoder.cpp b/content/media/encoder/TrackEncoder.cpp index cfc4a1532cba..5a193e9caeed 100644 --- a/content/media/encoder/TrackEncoder.cpp +++ b/content/media/encoder/TrackEncoder.cpp @@ -197,7 +197,7 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment) VideoChunk chunk = *iter; nsRefPtr image = chunk.mFrame.GetImage(); mRawSegment.AppendFrame(image.forget(), chunk.GetDuration(), - chunk.mFrame.GetIntrinsicSize()); + chunk.mFrame.GetIntrinsicSize().ToIntSize()); iter.Next(); } diff --git a/content/media/webrtc/MediaEngineDefault.cpp b/content/media/webrtc/MediaEngineDefault.cpp index 8ff4241fa76a..3dbb0851590a 100644 --- a/content/media/webrtc/MediaEngineDefault.cpp +++ b/content/media/webrtc/MediaEngineDefault.cpp @@ -247,9 +247,9 @@ MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph, // nullptr images are allowed if (image) { segment.AppendFrame(image.forget(), delta, - gfxIntSize(mOpts.mWidth, mOpts.mHeight)); + IntSize(mOpts.mWidth, mOpts.mHeight)); } else { - segment.AppendFrame(nullptr, delta, gfxIntSize(0,0)); + segment.AppendFrame(nullptr, delta, IntSize(0, 0)); } // This can fail if either a) we haven't added the track yet, or b) // we've removed or finished the track. diff --git a/content/media/webrtc/MediaEngineTabVideoSource.cpp b/content/media/webrtc/MediaEngineTabVideoSource.cpp index 36f9bdd5a22f..225019021c46 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp @@ -158,9 +158,9 @@ NotifyPull(MediaStreamGraph*, SourceMediaStream* aSource, mozilla::TrackID aID, // nullptr images are allowed if (image) { gfx::IntSize size = image->GetSize(); - segment.AppendFrame(image.forget(), delta, gfx::ThebesIntSize(size)); + segment.AppendFrame(image.forget(), delta, size); } else { - segment.AppendFrame(nullptr, delta, gfxIntSize(0,0)); + segment.AppendFrame(nullptr, delta, IntSize(0, 0)); } // This can fail if either a) we haven't added the track yet, or b) // we've removed or finished the track. diff --git a/content/media/webrtc/MediaEngineWebRTCVideo.cpp b/content/media/webrtc/MediaEngineWebRTCVideo.cpp index 92812f72ebbb..d4b39d86ab8c 100644 --- a/content/media/webrtc/MediaEngineWebRTCVideo.cpp +++ b/content/media/webrtc/MediaEngineWebRTCVideo.cpp @@ -143,9 +143,9 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph, if (delta > 0) { // nullptr images are allowed if (image) { - segment.AppendFrame(image.forget(), delta, gfxIntSize(mWidth, mHeight)); + segment.AppendFrame(image.forget(), delta, IntSize(mWidth, mHeight)); } else { - segment.AppendFrame(nullptr, delta, gfxIntSize(0,0)); + segment.AppendFrame(nullptr, delta, IntSize(0, 0)); } // This can fail if either a) we haven't added the track yet, or b) // we've removed or finished the track. diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 777a94da45d8..bffb9a0f8609 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -1243,8 +1243,7 @@ NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) { // delta and thus messes up handling of the graph if (delta > 0) { VideoSegment segment; - segment.AppendFrame(image ? image.forget() : nullptr, delta, - gfxIntSize(width_, height_)); + segment.AppendFrame(image.forget(), delta, IntSize(width_, height_)); // Handle track not actually added yet or removed/finished if (source_->AppendToTrack(track_id_, &segment)) { played_ticks_ = target; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h index f58d9ceef019..b5e25017f3d8 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h @@ -154,7 +154,8 @@ class Fake_VideoGenerator { // AddTrack takes ownership of segment mozilla::VideoSegment *segment = new mozilla::VideoSegment(); // 10 fps. - segment->AppendFrame(image.forget(), mozilla::USECS_PER_S / 10, gfxIntSize(WIDTH, HEIGHT)); + segment->AppendFrame(image.forget(), mozilla::USECS_PER_S / 10, + IntSize(WIDTH, HEIGHT)); gen->mStream->GetStream()->AsSourceStream()->AppendToTrack(1, segment); }