Bug 1300871 - Rollback to use original duration in video case. r=jesup

MozReview-Commit-ID: 2gK8vvBKtkC

--HG--
extra : rebase_source : 1e1d2f01a1f39685365a7df061eba53c094eb10d
This commit is contained in:
ctai 2016-09-08 13:46:48 +08:00
parent 36a4f48491
commit 1d7c721cfc
2 changed files with 1 additions and 23 deletions

View File

@ -268,7 +268,6 @@ VideoTrackEncoder::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph,
if (aTrackEvents == TrackEventCommand::TRACK_EVENT_ENDED) {
LOG("[VideoTrackEncoder]: Receive TRACK_EVENT_ENDED .");
NotifyEndOfStream();
mFirstFrame = true;
}
}
@ -283,7 +282,6 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment)
VideoSegment::ChunkIterator iter(const_cast<VideoSegment&>(aSegment));
while (!iter.IsEnded()) {
VideoChunk chunk = *iter;
mTotalFrameDuration += chunk.GetDuration();
mLastFrameDuration += chunk.GetDuration();
// Send only the unique video frames for encoding.
// Or if we got the same video chunks more than 1 seconds,
@ -292,19 +290,6 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment)
(mLastFrameDuration >= mTrackRate)) {
RefPtr<layers::Image> image = chunk.mFrame.GetImage();
// Fixme: see bug 1290777. We should remove the useage of duration here and
// in |GetEncodedTrack|.
StreamTime duration;
if (mFirstFrame)
{
duration = chunk.GetDuration();
mFirstFrame = false;
} else {
MOZ_ASSERT(chunk.mTimeStamp >= mLastFrameTimeStamp);
TimeDuration timeDuration = chunk.mTimeStamp - mLastFrameTimeStamp;
duration = SecondsToMediaTime(timeDuration.ToSeconds());
}
// Because we may get chunks with a null image (due to input blocking),
// accumulate duration and give it to the next frame that arrives.
// Canonically incorrect - the duration should go to the previous frame
@ -313,13 +298,12 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment)
// in with each frame.
if (image) {
mRawSegment.AppendFrame(image.forget(),
duration,
mLastFrameDuration,
chunk.mFrame.GetIntrinsicSize(),
PRINCIPAL_HANDLE_NONE,
chunk.mFrame.GetForceBlack());
mLastFrameDuration = 0;
}
mLastFrameTimeStamp = chunk.mTimeStamp;
}
mLastFrame.TakeFrom(&chunk.mFrame);
iter.Next();

View File

@ -258,8 +258,6 @@ public:
, mTotalFrameDuration(0)
, mLastFrameDuration(0)
, mVideoBitrate(0)
, mLastFrameTimeStamp(TimeStamp::Now())
, mFirstFrame(true)
{}
/**
@ -359,10 +357,6 @@ protected:
VideoSegment mRawSegment;
uint32_t mVideoBitrate;
private:
TimeStamp mLastFrameTimeStamp;
bool mFirstFrame;
};
} // namespace mozilla