From 1d7c721cfc6397f91061a5de9dd76cd03dc98828 Mon Sep 17 00:00:00 2001 From: ctai Date: Thu, 8 Sep 2016 13:46:48 +0800 Subject: [PATCH] Bug 1300871 - Rollback to use original duration in video case. r=jesup MozReview-Commit-ID: 2gK8vvBKtkC --HG-- extra : rebase_source : 1e1d2f01a1f39685365a7df061eba53c094eb10d --- dom/media/encoder/TrackEncoder.cpp | 18 +----------------- dom/media/encoder/TrackEncoder.h | 6 ------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index cdcb4233c8c8..35d830c5418f 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -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(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 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(); diff --git a/dom/media/encoder/TrackEncoder.h b/dom/media/encoder/TrackEncoder.h index 80451c21a171..33f20e899031 100644 --- a/dom/media/encoder/TrackEncoder.h +++ b/dom/media/encoder/TrackEncoder.h @@ -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