Bug 1302573: [MSE] P4. Be consistent in datatype being used. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sat, 24 Sep 2016 20:43:32 +1000
changeset 417547 4e6f7b6e5bec7e76b0c146b7c5cf4024fd722ecc
parent 417546 b5ab7ffc4da00ba26421865a5663dbbf658ff351
child 417548 04d24572b5b199a29c9656f65c5a3e333e4f1ff5
push id30418
push userbmo:jyavenard@mozilla.com
push dateMon, 26 Sep 2016 05:26:55 +0000
reviewersgerald
bugs1302573
milestone52.0a1
Bug 1302573: [MSE] P4. Be consistent in datatype being used. r?gerald When using gcc on linux, about:media shows incorrect content due to incorrect printf formatter. MozReview-Commit-ID: IWtl6cX1OFA
dom/media/mediasource/TrackBuffersManager.cpp
dom/media/mediasource/TrackBuffersManager.h
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1604,40 +1604,40 @@ TrackBuffersManager::CheckNextInsertionI
 {
   if (aTrackData.mNextInsertionIndex.isSome()) {
     return true;
   }
 
   TrackBuffer& data = aTrackData.mBuffers.LastElement();
 
   if (data.IsEmpty() || aSampleTime < aTrackData.mBufferedRanges.GetStart()) {
-    aTrackData.mNextInsertionIndex = Some(size_t(0));
+    aTrackData.mNextInsertionIndex = Some(0u);
     return true;
   }
 
   // Find which discontinuity we should insert the frame before.
   TimeInterval target;
   for (const auto& interval : aTrackData.mBufferedRanges) {
     if (aSampleTime < interval.mStart) {
       target = interval;
       break;
     }
   }
   if (target.IsEmpty()) {
     // No target found, it will be added at the end of the track buffer.
-    aTrackData.mNextInsertionIndex = Some(data.Length());
+    aTrackData.mNextInsertionIndex = Some(uint32_t(data.Length()));
     return true;
   }
   // We now need to find the first frame of the searched interval.
   // We will insert our new frames right before.
   for (uint32_t i = 0; i < data.Length(); i++) {
     const RefPtr<MediaRawData>& sample = data[i];
     if (sample->mTime >= target.mStart.ToMicroseconds() ||
         sample->GetEndTime() > target.mStart.ToMicroseconds()) {
-      aTrackData.mNextInsertionIndex = Some(size_t(i));
+      aTrackData.mNextInsertionIndex = Some(i);
       return true;
     }
   }
   NS_ASSERTION(false, "Insertion Index Not Found");
   return false;
 }
 
 void
@@ -1687,17 +1687,17 @@ TrackBuffersManager::InsertFrames(TrackB
       // so the search for when to start our frames removal can be exhaustive.
       // This is a workaround for bug 1276184 and only until either bug 1277733
       // or bug 1209386 is fixed.
       // With the webm container, we can't always properly determine the
       // duration of the last frame, which may cause the last frame of a cluster
       // to overlap the following frame.
       trackBuffer.mNextInsertionIndex.reset();
     }
-    size_t index =
+    uint32_t index =
       RemoveFrames(aIntervals, trackBuffer, trackBuffer.mNextInsertionIndex.refOr(0));
     if (index) {
       trackBuffer.mNextInsertionIndex = Some(index);
     }
   }
 
   // 16. Add the coded frame with the presentation timestamp, decode timestamp, and frame duration to the track buffer.
   if (!CheckNextInsertionIndex(aTrackData,
@@ -1745,17 +1745,17 @@ TrackBuffersManager::UpdateHighestTimest
                                             const media::TimeUnit& aHighestTime)
 {
   if (aHighestTime > aTrackData.mHighestStartTimestamp) {
     MonitorAutoLock mon(mMonitor);
     aTrackData.mHighestStartTimestamp = aHighestTime;
   }
 }
 
-size_t
+uint32_t
 TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
                                   TrackData& aTrackData,
                                   uint32_t aStartIndex)
 {
   TrackBuffer& data = aTrackData.mBuffers.LastElement();
   Maybe<uint32_t> firstRemovedIndex;
   uint32_t lastRemovedIndex = 0;
 
@@ -2184,17 +2184,17 @@ TrackBuffersManager::SkipToNextRandomAcc
     UpdateEvictionIndex(trackData, trackData.mNextGetSampleIndex.ref());
   }
 
   return parsed;
 }
 
 const MediaRawData*
 TrackBuffersManager::GetSample(TrackInfo::TrackType aTrack,
-                               size_t aIndex,
+                               uint32_t aIndex,
                                const TimeUnit& aExpectedDts,
                                const TimeUnit& aExpectedPts,
                                const TimeUnit& aFuzz)
 {
   MOZ_ASSERT(OnTaskQueue());
   const TrackBuffer& track = GetTrackBuffer(aTrack);
 
   if (aIndex >= track.Length()) {
--- a/dom/media/mediasource/TrackBuffersManager.h
+++ b/dom/media/mediasource/TrackBuffersManager.h
@@ -303,17 +303,17 @@ private:
     RefPtr<MediaTrackDemuxer> mDemuxer;
     MozPromiseRequestHolder<MediaTrackDemuxer::SamplesPromise> mDemuxRequest;
     // Highest end timestamp of the last media segment demuxed.
     media::TimeUnit mLastParsedEndTime;
 
     // If set, position where the next contiguous frame will be inserted.
     // If a discontinuity is detected, it will be unset and recalculated upon
     // the next insertion.
-    Maybe<size_t> mNextInsertionIndex;
+    Maybe<uint32_t> mNextInsertionIndex;
     // Samples just demuxed, but not yet parsed.
     TrackBuffer mQueuedSamples;
     // We only manage a single track of each type at this time.
     nsTArray<TrackBuffer> mBuffers;
     // Track buffer ranges variable that represents the presentation time ranges
     // occupied by the coded frames currently stored in the track buffer.
     media::TimeIntervals mBufferedRanges;
     // Sanitized mBufferedRanges with a fuzz of half a sample's duration applied
@@ -376,27 +376,27 @@ private:
   void InsertFrames(TrackBuffer& aSamples,
                     const media::TimeIntervals& aIntervals,
                     TrackData& aTrackData);
   void UpdateHighestTimestamp(TrackData& aTrackData,
                               const media::TimeUnit& aHighestTime);
   // Remove all frames and their dependencies contained in aIntervals.
   // Return the index at which frames were first removed or 0 if no frames
   // removed.
-  size_t RemoveFrames(const media::TimeIntervals& aIntervals,
-                      TrackData& aTrackData,
-                      uint32_t aStartIndex);
+  uint32_t RemoveFrames(const media::TimeIntervals& aIntervals,
+                        TrackData& aTrackData,
+                        uint32_t aStartIndex);
   // Recalculate track's evictable amount.
   void ResetEvictionIndex(TrackData& aTrackData);
   void UpdateEvictionIndex(TrackData& aTrackData, uint32_t aCurrentIndex);
   // Find index of sample. Return a negative value if not found.
   uint32_t FindSampleIndex(const TrackBuffer& aTrackBuffer,
                            const media::TimeInterval& aInterval);
   const MediaRawData* GetSample(TrackInfo::TrackType aTrack,
-                                size_t aIndex,
+                                uint32_t aIndex,
                                 const media::TimeUnit& aExpectedDts,
                                 const media::TimeUnit& aExpectedPts,
                                 const media::TimeUnit& aFuzz);
   void UpdateBufferedRanges();
   void RejectProcessing(const MediaResult& aRejectValue, const char* aName);
   void ResolveProcessing(bool aResolveValue, const char* aName);
   MozPromiseRequestHolder<CodedFrameProcessingPromise> mProcessingRequest;
   MozPromiseHolder<CodedFrameProcessingPromise> mProcessingPromise;