Bug 1540748 - part2 : add warning for negative adjusted time. r=jolin
authoralwu <alwu@mozilla.com>
Mon, 29 Apr 2019 21:44:06 +0000
changeset 531170 7a04d9e5975407828f087eb38ac6d4b51deada94
parent 531169 3835a514150a7f69310c9e8e8892acdb975e9d9f
child 531171 cd00280a10c63d61f7cc5295965a5525a9e969e7
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjolin
bugs1540748
milestone68.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 1540748 - part2 : add warning for negative adjusted time. r=jolin As the purpose of adjusting time is to make the start of the playback to align to zero, so the result should not be negative. However, we can't always ensure the demuxed start time is correct, the decoded first frame sample time might be different with the time demuxer provides. Even if we try to update the start time when we get the first decoded sample, there is still a problem because a decoder might return samples with different order, which means the first frame the decoder returns is probably not a real first frame. Therefore, using warning to help us knows how many this situaion would be. Differential Revision: https://phabricator.services.mozilla.com/D28432
dom/media/MediaData.h
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -295,16 +295,19 @@ class MediaData {
   bool mKeyframe;
 
   media::TimeUnit GetEndTime() const { return mTime + mDuration; }
 
   // Return true if the adjusted time is valid. Caller should handle error when
   // the result is invalid.
   virtual bool AdjustForStartTime(const media::TimeUnit& aStartTime) {
     mTime -= aStartTime;
+    if (mTime.IsNegative()) {
+      NS_WARNING("Negative start time after time-adjustment!");
+    }
     return mTime.IsValid();
   }
 
   template <typename ReturnType>
   const ReturnType* As() const {
     MOZ_ASSERT(this->mType == ReturnType::sType);
     return static_cast<const ReturnType*>(this);
   }