From 7d3964aa086ef545c1c4f11d0b0d320c775322de Mon Sep 17 00:00:00 2001 From: Chris Double Date: Thu, 22 Apr 2010 12:32:52 +1200 Subject: [PATCH] Bug 560806 - No duration or seeking on Ogg video URL's that redirect - r=roc (CLOSED TREE) --- .../html/content/src/nsHTMLMediaElement.cpp | 19 +++++++++++++++++++ content/media/test/manifest.js | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index 74404b0e2199..62f172056674 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -441,6 +441,25 @@ nsHTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel, { NS_ASSERTION(aChannel == mChannel, "Channels should match!"); mChannel = aNewChannel; + + // Handle forwarding of Range header so that the intial detection + // of seeking support (via result code 206) works across redirects. + nsCOMPtr http = do_QueryInterface(aChannel); + NS_ENSURE_STATE(http); + + NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range"); + + nsCAutoString rangeVal; + if (NS_SUCCEEDED(http->GetRequestHeader(rangeHdr, rangeVal))) { + NS_ENSURE_STATE(!rangeVal.IsEmpty()); + + http = do_QueryInterface(aNewChannel); + NS_ENSURE_STATE(http); + + nsresult rv = http->SetRequestHeader(rangeHdr, rangeVal, PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + } + return NS_OK; } diff --git a/content/media/test/manifest.js b/content/media/test/manifest.js index d0ee0e6268ac..8c3cb5f526a7 100644 --- a/content/media/test/manifest.js +++ b/content/media/test/manifest.js @@ -75,6 +75,10 @@ var gPlayTests = [ { name:"audio-overhang.ogg", type:"audio/ogg", duration:2.3 }, { name:"video-overhang.ogg", type:"audio/ogg", duration:3.966 }, + // Test playback/metadata work after a redirect + { name:"redirect.sjs?http://mochi.test:8888/tests/content/media/test/320x240.ogv", + type:"video/ogg", duration:0.233 }, + { name:"bogus.duh", type:"bogus/duh" } ];