summaryrefslogtreecommitdiffstats
path: root/dom/media/ChannelMediaResource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/ChannelMediaResource.cpp')
-rw-r--r--dom/media/ChannelMediaResource.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/dom/media/ChannelMediaResource.cpp b/dom/media/ChannelMediaResource.cpp
index aefedb37d1..15f048d735 100644
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -227,7 +227,7 @@ nsresult ChannelMediaResource::OnStartRequest(nsIRequest* aRequest,
// at this stage.
// For now, tell the decoder that the stream is infinite.
if (rangeTotal != -1) {
- contentLength = std::max(contentLength, rangeTotal);
+ length = std::max(contentLength, rangeTotal);
}
}
acceptsRanges = gotRangeHeader;
@@ -240,11 +240,9 @@ nsresult ChannelMediaResource::OnStartRequest(nsIRequest* aRequest,
// to assume seeking doesn't work.
acceptsRanges = false;
}
- }
- if (aRequestOffset == 0 && contentLength >= 0 &&
- (responseStatus == HTTP_OK_CODE ||
- responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
- length = contentLength;
+ if (contentLength >= 0) {
+ length = contentLength;
+ }
}
// XXX we probably should examine the Content-Range header in case
// the server gave us a range which is not quite what we asked for
@@ -488,9 +486,9 @@ int64_t ChannelMediaResource::CalculateStreamLength() const {
bool gotRangeHeader = NS_SUCCEEDED(
ParseContentRangeHeader(hc, rangeStart, rangeEnd, rangeTotal));
if (gotRangeHeader && rangeTotal != -1) {
- contentLength = std::max(contentLength, rangeTotal);
+ return std::max(contentLength, rangeTotal);
}
- return contentLength;
+ return -1;
}
nsresult ChannelMediaResource::Open(nsIStreamListener** aStreamListener) {