Bug 952033 - Part e: Use IntSize in VideoSegment; r=roc

This commit is contained in:
Ms2ger 2014-02-09 09:04:38 +01:00
parent 0ae39bb1aa
commit 31c7d64437
9 changed files with 17 additions and 14 deletions

View File

@ -620,7 +620,7 @@ static void WriteVideoToMediaStream(layers::Image* aImage,
VideoSegment* aOutput)
{
nsRefPtr<layers::Image> image = aImage;
aOutput->AppendFrame(image.forget(), aDuration, ThebesIntSize(aIntrinsicSize));
aOutput->AppendFrame(image.forget(), aDuration, aIntrinsicSize);
}
static const TrackID TRACK_AUDIO = 1;

View File

@ -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<Image> 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);
}

View File

@ -84,12 +84,13 @@ struct VideoChunk {
class VideoSegment : public MediaSegmentBase<VideoSegment, VideoChunk> {
public:
typedef mozilla::layers::Image Image;
typedef mozilla::gfx::IntSize IntSize;
VideoSegment();
~VideoSegment();
void AppendFrame(already_AddRefed<Image> aImage, TrackTicks aDuration,
const gfxIntSize& aIntrinsicSize);
const IntSize& aIntrinsicSize);
const VideoFrame* GetFrameAt(TrackTicks aOffset, TrackTicks* aStart = nullptr)
{
VideoChunk* c = FindChunkContaining(aOffset, aStart);

View File

@ -197,7 +197,7 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment)
VideoChunk chunk = *iter;
nsRefPtr<layers::Image> image = chunk.mFrame.GetImage();
mRawSegment.AppendFrame(image.forget(), chunk.GetDuration(),
chunk.mFrame.GetIntrinsicSize());
chunk.mFrame.GetIntrinsicSize().ToIntSize());
iter.Next();
}

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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;

View File

@ -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);
}