зеркало из https://github.com/mozilla/gecko-dev.git
Bug 952033 - Part e: Use IntSize in VideoSegment; r=roc
This commit is contained in:
Родитель
7f9273ba28
Коммит
59d9de38de
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче