Bug 1127203 - Use the tolerance value in TrackBuffersContainTime so that seeking operates with tolerance too. r=mattwoodrow, a=sledru
authorBobby Holley <bobbyholley@gmail.com>
Fri, 30 Jan 2015 17:45:49 -0800
changeset 243631 858dc45e6536
parent 243630 3dc1818e2427
child 243632 e98376bbdf79
push id4420
push userryanvm@gmail.com
push date2015-02-02 16:43 +0000
treeherdermozilla-beta@e98376bbdf79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, sledru
bugs1127203
milestone36.0
Bug 1127203 - Use the tolerance value in TrackBuffersContainTime so that seeking operates with tolerance too. r=mattwoodrow, a=sledru
dom/media/mediasource/MediaSourceReader.cpp
dom/media/mediasource/TrackBuffer.cpp
dom/media/mediasource/TrackBuffer.h
--- a/dom/media/mediasource/MediaSourceReader.cpp
+++ b/dom/media/mediasource/MediaSourceReader.cpp
@@ -620,20 +620,20 @@ MediaSourceReader::OnTrackBufferConfigur
   }
   mDecoder->NotifyWaitingForResourcesStatusChanged();
 }
 
 bool
 MediaSourceReader::TrackBuffersContainTime(int64_t aTime)
 {
   ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-  if (mAudioTrack && !mAudioTrack->ContainsTime(aTime)) {
+  if (mAudioTrack && !mAudioTrack->ContainsTime(aTime, EOS_FUZZ_US)) {
     return false;
   }
-  if (mVideoTrack && !mVideoTrack->ContainsTime(aTime)) {
+  if (mVideoTrack && !mVideoTrack->ContainsTime(aTime, EOS_FUZZ_US)) {
     return false;
   }
   return true;
 }
 
 void
 MediaSourceReader::NotifyTimeRangesChanged()
 {
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -579,23 +579,24 @@ bool
 TrackBuffer::IsReady()
 {
   ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
   MOZ_ASSERT((mInfo.HasAudio() || mInfo.HasVideo()) || mInitializedDecoders.IsEmpty());
   return mParser->HasInitData() && (mInfo.HasAudio() || mInfo.HasVideo());
 }
 
 bool
-TrackBuffer::ContainsTime(int64_t aTime)
+TrackBuffer::ContainsTime(int64_t aTime, int64_t aTolerance)
 {
   ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
   for (uint32_t i = 0; i < mInitializedDecoders.Length(); ++i) {
     nsRefPtr<dom::TimeRanges> r = new dom::TimeRanges();
     mInitializedDecoders[i]->GetBuffered(r);
-    if (r->Find(double(aTime) / USECS_PER_S) != dom::TimeRanges::NoIndex) {
+    if (r->Find(double(aTime) / USECS_PER_S,
+                double(aTolerance) / USECS_PER_S) != dom::TimeRanges::NoIndex) {
       return true;
     }
   }
 
   return false;
 }
 
 void
--- a/dom/media/mediasource/TrackBuffer.h
+++ b/dom/media/mediasource/TrackBuffer.h
@@ -71,17 +71,17 @@ public:
   bool HasInitSegment();
 
   // Returns true iff mParser->HasInitData() and the decoder using that init
   // segment has successfully initialized by setting mHas{Audio,Video}..
   bool IsReady();
 
   // Returns true if any of the decoders managed by this track buffer
   // contain aTime in their buffered ranges.
-  bool ContainsTime(int64_t aTime);
+  bool ContainsTime(int64_t aTime, int64_t aTolerance);
 
   void BreakCycles();
 
   // Call ResetDecode() on each decoder in mDecoders.
   void ResetDecode();
 
   // Run MSE Reset Parser State Algorithm.
   // 3.5.2 Reset Parser State