Bug 1356502. P2 - let VideoData::UpdateTimestamp() take a TimeUnit instead of ambiguous int64_t.
MozReview-Commit-ID: G17uLSrjBrR
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -225,25 +225,24 @@ VideoData::SizeOfIncludingThis(MallocSiz
void
VideoData::UpdateDuration(const TimeUnit& aDuration)
{
MOZ_ASSERT(!aDuration.IsNegative());
mDuration = aDuration;
}
void
-VideoData::UpdateTimestamp(int64_t aTimestamp)
+VideoData::UpdateTimestamp(const TimeUnit& aTimestamp)
{
- MOZ_ASSERT(aTimestamp >= 0);
+ MOZ_ASSERT(!aTimestamp.IsNegative());
- auto updatedDuration =
- GetEndTime() - TimeUnit::FromMicroseconds(aTimestamp);
+ auto updatedDuration = GetEndTime() - aTimestamp;
MOZ_ASSERT(!updatedDuration.IsNegative());
- mTime = aTimestamp;
+ mTime = aTimestamp.ToMicroseconds();
mDuration = updatedDuration;
}
/* static */
bool VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
const VideoInfo& aInfo,
const YCbCrBuffer &aBuffer,
const IntRect& aPicture,
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -557,17 +557,17 @@ public:
IntSize aDisplay,
uint32_t aFrameID);
void SetListener(UniquePtr<Listener> aListener);
void MarkSentToCompositor();
bool IsSentToCompositor() { return mSentToCompositor; }
void UpdateDuration(const media::TimeUnit& aDuration);
- void UpdateTimestamp(int64_t aTimestamp);
+ void UpdateTimestamp(const media::TimeUnit& aTimestamp);
protected:
~VideoData();
bool mSentToCompositor;
UniquePtr<Listener> mListener;
};
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1415,17 +1415,17 @@ private:
aVideo->mTime, aVideo->GetEndTime().ToMicroseconds(),
target.ToMicroseconds());
mFirstVideoFrameAfterSeek = aVideo;
} else {
if (target.ToMicroseconds() >= aVideo->mTime &&
aVideo->GetEndTime() >= target) {
// The seek target lies inside this frame's time slice. Adjust the
// frame's start time to match the seek target.
- aVideo->UpdateTimestamp(target.ToMicroseconds());
+ aVideo->UpdateTimestamp(target);
}
mFirstVideoFrameAfterSeek = nullptr;
SLOG("DropVideoUpToSeekTarget() found video frame [%" PRId64 ", %" PRId64 "] "
"containing target=%" PRId64,
aVideo->mTime, aVideo->GetEndTime().ToMicroseconds(),
target.ToMicroseconds());