Bug 1180214: P1. Don't attempt to estimate duration until read metadata completed. r=cpearce, a=ritu
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 18 Aug 2015 01:08:24 +1000
changeset 282071 4e1434b2aeb6f62aae719933d332ab59e1426c1a
parent 282068 96c60ab03df8cc632f718c288c4ada209cf30c62
child 282072 4555ce853395e0e6a838ca57bebef956d64efb57
push id5002
push userjyavenard@mozilla.com
push dateFri, 28 Aug 2015 06:20:09 +0000
treeherdermozilla-beta@cc43b2523d7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, ritu
bugs1180214, 1175768
milestone41.0
Bug 1180214: P1. Don't attempt to estimate duration until read metadata completed. r=cpearce, a=ritu This revert to the behaviour prior bug 1175768
dom/media/gstreamer/GStreamerReader.cpp
--- a/dom/media/gstreamer/GStreamerReader.cpp
+++ b/dom/media/gstreamer/GStreamerReader.cpp
@@ -880,19 +880,20 @@ media::TimeIntervals GStreamerReader::Ge
 
 #if GST_VERSION_MAJOR == 0
   GstFormat format = GST_FORMAT_TIME;
 #endif
   AutoPinned<MediaResource> resource(mDecoder->GetResource());
   nsTArray<MediaByteRange> ranges;
   resource->GetCachedRanges(ranges);
 
-  if (resource->IsDataCachedToEndOfResource(0) && mDuration.ReadOnWrongThread().isSome()) {
+  if (resource->IsDataCachedToEndOfResource(0)) {
     /* fast path for local or completely cached files */
-    gint64 duration = mDuration.ReadOnWrongThread().ref().ToMicroseconds();
+    gint64 duration =
+      mDuration.ReadOnWrongThread().refOr(media::TimeUnit::FromMicroseconds(0)).ToMicroseconds();
     LOG(LogLevel::Debug, "complete range [0, %f] for [0, %li]",
         (double) duration / GST_MSECOND, GetDataLength());
     buffered +=
       media::TimeInterval(media::TimeUnit::FromMicroseconds(0),
                           media::TimeUnit::FromMicroseconds(duration));
     return buffered;
   }