Bug 1530918 - Use TimeUnit when seeking. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 27 Feb 2019 13:12:08 +0000
changeset 461550 3cbb661802a7496a7045a4ef39f22253a966442a
parent 461549 b437ff8ed47c2bad4b0351ac26453459a89cbb44
child 461551 0bd5d868443675304f64f1d85866338f651f5900
push id35625
push usercsabou@mozilla.com
push dateThu, 28 Feb 2019 10:55:23 +0000
treeherdermozilla-central@fd53d5e80bca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1530918
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530918 - Use TimeUnit when seeking. r=bryce Differential Revision: https://phabricator.services.mozilla.com/D21320
dom/media/MediaDecoder.cpp
dom/media/SeekTarget.h
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -585,22 +585,22 @@ void MediaDecoder::Play() {
 
 void MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
 
   AbstractThread::AutoEnter context(AbstractMainThread());
   MOZ_ASSERT(aTime >= 0.0, "Cannot seek to a negative value.");
 
-  int64_t timeUsecs = TimeUnit::FromSeconds(aTime).ToMicroseconds();
+  auto time = TimeUnit::FromSeconds(aTime);
 
   mLogicalPosition = aTime;
 
   mLogicallySeeking = true;
-  SeekTarget target = SeekTarget(timeUsecs, aSeekType);
+  SeekTarget target = SeekTarget(time, aSeekType);
   CallSeek(target);
 
   if (mPlayState == PLAY_STATE_ENDED) {
     ChangeState(GetOwner()->GetPaused() ? PLAY_STATE_PAUSED
                                         : PLAY_STATE_PLAYING);
   }
 }
 
--- a/dom/media/SeekTarget.h
+++ b/dom/media/SeekTarget.h
@@ -22,20 +22,16 @@ struct SeekTarget {
     PrevSyncPoint,
     Accurate,
     NextFrame,
   };
   SeekTarget()
       : mTime(media::TimeUnit::Invalid()),
         mType(SeekTarget::Invalid),
         mVideoOnly(false) {}
-  SeekTarget(int64_t aTimeUsecs, Type aType, bool aVideoOnly = false)
-      : mTime(media::TimeUnit::FromMicroseconds(aTimeUsecs)),
-        mType(aType),
-        mVideoOnly(aVideoOnly) {}
   SeekTarget(const media::TimeUnit& aTime, Type aType, bool aVideoOnly = false)
       : mTime(aTime), mType(aType), mVideoOnly(aVideoOnly) {}
   SeekTarget(const SeekTarget& aOther)
       : mTime(aOther.mTime),
         mType(aOther.mType),
         mVideoOnly(aOther.mVideoOnly) {}
   bool IsValid() const { return mType != SeekTarget::Invalid; }
   void Reset() {