Bug 1530918 - Use TimeUnit when seeking. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 27 Feb 2019 13:12:08 +0000
changeset 461653 3cbb661802a7496a7045a4ef39f22253a966442a
parent 461652 b437ff8ed47c2bad4b0351ac26453459a89cbb44
child 461654 0bd5d868443675304f64f1d85866338f651f5900
push id112205
push usercsabou@mozilla.com
push dateThu, 28 Feb 2019 11:44:16 +0000
treeherdermozilla-inbound@2abeddffd18c [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() {