Bug 1405697 - Move SEEK_VS_READ_THRESHOLD to where it's used. r=jwwang draft
authorChris Pearce <cpearce@mozilla.com>
Wed, 04 Oct 2017 16:55:50 +0200
changeset 675487 f25c30d6e9be10549af80d5dfa963ef66abac576
parent 675486 15aa06371c90e379e31383d2a8527d865944a4c3
child 675488 edef4a65df4dcb92f8536052d170d78f95315753
push id83131
push userbmo:cpearce@mozilla.com
push dateThu, 05 Oct 2017 09:31:51 +0000
reviewersjwwang
bugs1405697
milestone58.0a1
Bug 1405697 - Move SEEK_VS_READ_THRESHOLD to where it's used. r=jwwang It's only used in MediaCache.cpp, so it may as well be defined there. MozReview-Commit-ID: HcA499xFOUg
dom/media/MediaCache.cpp
dom/media/MediaResource.h
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -31,16 +31,24 @@
 namespace mozilla {
 
 #undef LOG
 #undef LOGI
 LazyLogModule gMediaCacheLog("MediaCache");
 #define LOG(...) MOZ_LOG(gMediaCacheLog, LogLevel::Debug, (__VA_ARGS__))
 #define LOGI(...) MOZ_LOG(gMediaCacheLog, LogLevel::Info, (__VA_ARGS__))
 
+// For HTTP seeking, if number of bytes needing to be
+// seeked forward is less than this value then a read is
+// done rather than a byte range request.
+//
+// If we assume a 100Mbit connection, and assume reissuing an HTTP seek causes
+// a delay of 200ms, then in that 200ms we could have simply read ahead 2MB. So
+// setting SEEK_VS_READ_THRESHOLD to 1MB sounds reasonable.
+static const int64_t SEEK_VS_READ_THRESHOLD = 1 * 1024 * 1024;
 
 // Readahead blocks for non-seekable streams will be limited to this
 // fraction of the cache space. We don't normally evict such blocks
 // because replacing them requires a seek, but we need to make sure
 // they don't monopolize the cache.
 static const double NONSEEKABLE_READAHEAD_MAX = 0.5;
 
 // Data N seconds before the current playback position is given the same priority
--- a/dom/media/MediaResource.h
+++ b/dom/media/MediaResource.h
@@ -22,25 +22,16 @@
 #include "MediaResourceCallback.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "nsThreadUtils.h"
 #include <algorithm>
 
-// For HTTP seeking, if number of bytes needing to be
-// seeked forward is less than this value then a read is
-// done rather than a byte range request.
-//
-// If we assume a 100Mbit connection, and assume reissuing an HTTP seek causes
-// a delay of 200ms, then in that 200ms we could have simply read ahead 2MB. So
-// setting SEEK_VS_READ_THRESHOLD to 1MB sounds reasonable.
-static const int64_t SEEK_VS_READ_THRESHOLD = 1 * 1024 * 1024;
-
 class nsIHttpChannel;
 class nsIPrincipal;
 
 namespace mozilla {
 
 // Represents a section of contiguous media, with a start and end offset.
 // Used to denote ranges of data which are cached.