Bug 945864 - Remove buggy MediaOmxReader::GetBuffered method override. r=cpearce, a=1.3+
authorEdwin Flores <eflores@mozilla.com>
Tue, 14 Jan 2014 12:38:40 +1300
changeset 175718 724948445046bcb3ef48cef22033cf6b98b58dfc
parent 175717 2353b531ccc61fd6764cdb36b770d97afc0e9296
child 175719 27265d86c0eab9e796276fd90046d14b37b944bd
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, 1
bugs945864
milestone28.0a2
Bug 945864 - Remove buggy MediaOmxReader::GetBuffered method override. r=cpearce, a=1.3+
content/media/omx/MediaOmxReader.cpp
content/media/omx/MediaOmxReader.h
--- a/content/media/omx/MediaOmxReader.cpp
+++ b/content/media/omx/MediaOmxReader.cpp
@@ -355,61 +355,16 @@ nsresult MediaOmxReader::Seek(int64_t aT
 
 static uint64_t BytesToTime(int64_t offset, uint64_t length, uint64_t durationUs) {
   double perc = double(offset) / double(length);
   if (perc > 1.0)
     perc = 1.0;
   return uint64_t(double(durationUs) * perc);
 }
 
-nsresult MediaOmxReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime)
-{
-  if (!mOmxDecoder.get())
-    return NS_OK;
-
-  MediaResource* stream = mOmxDecoder->GetResource();
-
-  int64_t durationUs = 0;
-  mOmxDecoder->GetDuration(&durationUs);
-
-  // Nothing to cache if the media takes 0us to play.
-  if (!durationUs)
-    return NS_OK;
-
-  // Special case completely cached files.  This also handles local files.
-  if (stream->IsDataCachedToEndOfResource(0)) {
-    aBuffered->Add(0, durationUs);
-    return NS_OK;
-  }
-
-  int64_t totalBytes = stream->GetLength();
-
-  // If we can't determine the total size, pretend that we have nothing
-  // buffered. This will put us in a state of eternally-low-on-undecoded-data
-  // which is not get, but about the best we can do.
-  if (totalBytes == -1)
-    return NS_OK;
-
-  int64_t startOffset = stream->GetNextCachedData(0);
-  while (startOffset >= 0) {
-    int64_t endOffset = stream->GetCachedDataEnd(startOffset);
-    // Bytes [startOffset..endOffset] are cached.
-    NS_ASSERTION(startOffset >= 0, "Integer underflow in GetBuffered");
-    NS_ASSERTION(endOffset >= 0, "Integer underflow in GetBuffered");
-
-    uint64_t startUs = BytesToTime(startOffset, totalBytes, durationUs);
-    uint64_t endUs = BytesToTime(endOffset, totalBytes, durationUs);
-    if (startUs != endUs) {
-      aBuffered->Add((double)startUs / USECS_PER_S, (double)endUs / USECS_PER_S);
-    }
-    startOffset = stream->GetNextCachedData(endOffset);
-  }
-  return NS_OK;
-}
-
 void MediaOmxReader::OnDecodeThreadFinish() {
   if (mOmxDecoder.get()) {
     mOmxDecoder->Pause();
   }
 }
 
 void MediaOmxReader::OnDecodeThreadStart() {
   if (mOmxDecoder.get()) {
--- a/content/media/omx/MediaOmxReader.h
+++ b/content/media/omx/MediaOmxReader.h
@@ -70,17 +70,16 @@ public:
   virtual bool IsDormantNeeded();
   virtual void ReleaseMediaResources();
 
   virtual void ReleaseDecoder() MOZ_OVERRIDE;
 
   virtual nsresult ReadMetadata(MediaInfo* aInfo,
                                 MetadataTags** aTags);
   virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
-  virtual nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime);
 
   virtual void OnDecodeThreadStart() MOZ_OVERRIDE;
 
   virtual void OnDecodeThreadFinish() MOZ_OVERRIDE;
 };
 
 } // namespace mozilla