зеркало из https://github.com/mozilla/pjs.git
Backing out part of bug 703379 to fix build failure of nsRawReader
This commit is contained in:
Родитель
0a29071744
Коммит
06564542d5
|
@ -370,38 +370,21 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Initialize a decoder as a clone of an existing decoder in another
|
* Initialize a decoder as a clone of an existing decoder in another
|
||||||
* element.
|
* element.
|
||||||
* mLoadingSrc must already be set.
|
|
||||||
*/
|
*/
|
||||||
nsresult InitializeDecoderAsClone(nsMediaDecoder* aOriginal);
|
nsresult InitializeDecoderAsClone(nsMediaDecoder* aOriginal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a decoder to load the given channel. The decoder's stream
|
* Initialize a decoder to load the given channel. The decoder's stream
|
||||||
* listener is returned via aListener.
|
* listener is returned via aListener.
|
||||||
* mLoadingSrc must already be set.
|
|
||||||
*/
|
*/
|
||||||
nsresult InitializeDecoderForChannel(nsIChannel *aChannel,
|
nsresult InitializeDecoderForChannel(nsIChannel *aChannel,
|
||||||
nsIStreamListener **aListener);
|
nsIStreamListener **aListener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finish setting up the decoder after Load() has been called on it.
|
* Finish setting up the decoder after Load() has been called on it.
|
||||||
* Called by InitializeDecoderForChannel/InitializeDecoderAsClone.
|
|
||||||
*/
|
*/
|
||||||
nsresult FinishDecoderSetup(nsMediaDecoder* aDecoder);
|
nsresult FinishDecoderSetup(nsMediaDecoder* aDecoder);
|
||||||
|
|
||||||
/**
|
|
||||||
* Call this after setting up mLoadingSrc and mDecoder.
|
|
||||||
*/
|
|
||||||
void AddMediaElementToURITable();
|
|
||||||
/**
|
|
||||||
* Call this before clearing mLoadingSrc.
|
|
||||||
*/
|
|
||||||
void RemoveMediaElementFromURITable();
|
|
||||||
/**
|
|
||||||
* Call this to find a media element with the same NodePrincipal and mLoadingSrc
|
|
||||||
* set to aURI, and with a decoder on which Load() has been called.
|
|
||||||
*/
|
|
||||||
nsHTMLMediaElement* LookupMediaElementURITable(nsIURI* aURI);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the initial steps of the load algorithm that ensure existing
|
* Execute the initial steps of the load algorithm that ensure existing
|
||||||
* loads are aborted, the element is emptied, and a new load ID is
|
* loads are aborted, the element is emptied, and a new load ID is
|
||||||
|
@ -448,7 +431,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* The resource-fetch algorithm step of the load algorithm.
|
* The resource-fetch algorithm step of the load algorithm.
|
||||||
*/
|
*/
|
||||||
nsresult LoadResource();
|
nsresult LoadResource(nsIURI* aURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects the next <source> child from which to load a resource. Called
|
* Selects the next <source> child from which to load a resource. Called
|
||||||
|
@ -509,11 +492,11 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspends the load of mLoadingSrc, so that it can be resumed later
|
* Suspends the load of resource at aURI, so that it can be resumed later
|
||||||
* by ResumeLoad(). This is called when we have a media with a 'preload'
|
* by ResumeLoad(). This is called when we have a media with a 'preload'
|
||||||
* attribute value of 'none', during the resource selection algorithm.
|
* attribute value of 'none', during the resource selection algorithm.
|
||||||
*/
|
*/
|
||||||
void SuspendLoad();
|
void SuspendLoad(nsIURI* aURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes a previously suspended load (suspended by SuspendLoad(uri)).
|
* Resumes a previously suspended load (suspended by SuspendLoad(uri)).
|
||||||
|
@ -552,7 +535,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
void ProcessMediaFragmentURI();
|
void ProcessMediaFragmentURI();
|
||||||
|
|
||||||
// The current decoder. Load() has been called on this decoder.
|
|
||||||
nsRefPtr<nsMediaDecoder> mDecoder;
|
nsRefPtr<nsMediaDecoder> mDecoder;
|
||||||
|
|
||||||
// A reference to the ImageContainer which contains the current frame
|
// A reference to the ImageContainer which contains the current frame
|
||||||
|
@ -615,11 +597,11 @@ protected:
|
||||||
// Current audio sample rate.
|
// Current audio sample rate.
|
||||||
PRUint32 mRate;
|
PRUint32 mRate;
|
||||||
|
|
||||||
// URI of the resource we're attempting to load. This stores the value we
|
// URI of the resource we're attempting to load. When the decoder is
|
||||||
// return in the currentSrc attribute. Use GetCurrentSrc() to access the
|
// successfully initialized, we rely on it to record the URI we're playing,
|
||||||
// currentSrc attribute.
|
// and clear mLoadingSrc. This stores the value we return in the currentSrc
|
||||||
// This is always the original URL we're trying to load --- before
|
// attribute until the decoder is initialized. Use GetCurrentSrc() to access
|
||||||
// redirects etc.
|
// the currentSrc attribute.
|
||||||
nsCOMPtr<nsIURI> mLoadingSrc;
|
nsCOMPtr<nsIURI> mLoadingSrc;
|
||||||
|
|
||||||
// Stores the current preload action for this element. Initially set to
|
// Stores the current preload action for this element. Initially set to
|
||||||
|
|
|
@ -89,7 +89,6 @@
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
#include "nsIDOMNotifyAudioAvailableEvent.h"
|
#include "nsIDOMNotifyAudioAvailableEvent.h"
|
||||||
#include "nsMediaFragmentURIParser.h"
|
#include "nsMediaFragmentURIParser.h"
|
||||||
#include "nsURIHashKey.h"
|
|
||||||
|
|
||||||
#ifdef MOZ_OGG
|
#ifdef MOZ_OGG
|
||||||
#include "nsOggDecoder.h"
|
#include "nsOggDecoder.h"
|
||||||
|
@ -480,14 +479,11 @@ void nsHTMLMediaElement::AbortExistingLoads()
|
||||||
mCurrentLoadID++;
|
mCurrentLoadID++;
|
||||||
|
|
||||||
bool fireTimeUpdate = false;
|
bool fireTimeUpdate = false;
|
||||||
|
|
||||||
if (mDecoder) {
|
if (mDecoder) {
|
||||||
RemoveMediaElementFromURITable();
|
|
||||||
fireTimeUpdate = mDecoder->GetCurrentTime() != 0.0;
|
fireTimeUpdate = mDecoder->GetCurrentTime() != 0.0;
|
||||||
mDecoder->Shutdown();
|
mDecoder->Shutdown();
|
||||||
mDecoder = nsnull;
|
mDecoder = nsnull;
|
||||||
}
|
}
|
||||||
mLoadingSrc = nsnull;
|
|
||||||
|
|
||||||
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING ||
|
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING ||
|
||||||
mNetworkState == nsIDOMHTMLMediaElement::NETWORK_IDLE)
|
mNetworkState == nsIDOMHTMLMediaElement::NETWORK_IDLE)
|
||||||
|
@ -501,7 +497,6 @@ void nsHTMLMediaElement::AbortExistingLoads()
|
||||||
mIsLoadingFromSourceChildren = false;
|
mIsLoadingFromSourceChildren = false;
|
||||||
mSuspendedAfterFirstFrame = false;
|
mSuspendedAfterFirstFrame = false;
|
||||||
mAllowSuspendAfterFirstFrame = true;
|
mAllowSuspendAfterFirstFrame = true;
|
||||||
mLoadIsSuspended = false;
|
|
||||||
mSourcePointer = nsnull;
|
mSourcePointer = nsnull;
|
||||||
|
|
||||||
// TODO: The playback rate must be set to the default playback rate.
|
// TODO: The playback rate must be set to the default playback rate.
|
||||||
|
@ -653,12 +648,12 @@ void nsHTMLMediaElement::SelectResource()
|
||||||
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
|
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
|
||||||
// preload:none media, suspend the load here before we make any
|
// preload:none media, suspend the load here before we make any
|
||||||
// network requests.
|
// network requests.
|
||||||
SuspendLoad();
|
SuspendLoad(uri);
|
||||||
mIsRunningSelectResource = false;
|
mIsRunningSelectResource = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = LoadResource();
|
rv = LoadResource(uri);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
mIsRunningSelectResource = false;
|
mIsRunningSelectResource = false;
|
||||||
return;
|
return;
|
||||||
|
@ -755,11 +750,11 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
|
||||||
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
|
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
|
||||||
// preload:none media, suspend the load here before we make any
|
// preload:none media, suspend the load here before we make any
|
||||||
// network requests.
|
// network requests.
|
||||||
SuspendLoad();
|
SuspendLoad(uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(LoadResource())) {
|
if (NS_SUCCEEDED(LoadResource(uri))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -769,7 +764,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
|
||||||
NS_NOTREACHED("Execution should not reach here!");
|
NS_NOTREACHED("Execution should not reach here!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLMediaElement::SuspendLoad()
|
void nsHTMLMediaElement::SuspendLoad(nsIURI* aURI)
|
||||||
{
|
{
|
||||||
mLoadIsSuspended = true;
|
mLoadIsSuspended = true;
|
||||||
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
|
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
|
||||||
|
@ -780,19 +775,20 @@ void nsHTMLMediaElement::SuspendLoad()
|
||||||
void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
|
void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mLoadIsSuspended, "Can only resume preload if halted for one");
|
NS_ASSERTION(mLoadIsSuspended, "Can only resume preload if halted for one");
|
||||||
|
nsCOMPtr<nsIURI> uri = mLoadingSrc;
|
||||||
mLoadIsSuspended = false;
|
mLoadIsSuspended = false;
|
||||||
mPreloadAction = aAction;
|
mPreloadAction = aAction;
|
||||||
ChangeDelayLoadStatus(true);
|
ChangeDelayLoadStatus(true);
|
||||||
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
|
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
|
||||||
if (!mIsLoadingFromSourceChildren) {
|
if (!mIsLoadingFromSourceChildren) {
|
||||||
// We were loading from the element's src attribute.
|
// We were loading from the element's src attribute.
|
||||||
if (NS_FAILED(LoadResource())) {
|
if (NS_FAILED(LoadResource(uri))) {
|
||||||
NoSupportedMediaSourceError();
|
NoSupportedMediaSourceError();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We were loading from a child <source> element. Try to resume the
|
// We were loading from a child <source> element. Try to resume the
|
||||||
// load of that child, and if that fails, try the next child.
|
// load of that child, and if that fails, try the next child.
|
||||||
if (NS_FAILED(LoadResource())) {
|
if (NS_FAILED(LoadResource(uri))) {
|
||||||
LoadFromSourceChildren();
|
LoadFromSourceChildren();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -877,7 +873,7 @@ void nsHTMLMediaElement::UpdatePreloadAction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLMediaElement::LoadResource()
|
nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDelayingLoadEvent,
|
NS_ASSERTION(mDelayingLoadEvent,
|
||||||
"Should delay load event (if in document) during load");
|
"Should delay load event (if in document) during load");
|
||||||
|
@ -894,17 +890,9 @@ nsresult nsHTMLMediaElement::LoadResource()
|
||||||
mChannel = nsnull;
|
mChannel = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
|
|
||||||
if (other) {
|
|
||||||
// Clone it.
|
|
||||||
nsresult rv = InitializeDecoderAsClone(other->mDecoder);
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
|
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
|
||||||
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
|
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
|
||||||
mLoadingSrc,
|
aURI,
|
||||||
NodePrincipal(),
|
NodePrincipal(),
|
||||||
static_cast<nsGenericElement*>(this),
|
static_cast<nsGenericElement*>(this),
|
||||||
EmptyCString(), // mime type
|
EmptyCString(), // mime type
|
||||||
|
@ -932,7 +920,7 @@ nsresult nsHTMLMediaElement::LoadResource()
|
||||||
}
|
}
|
||||||
nsCOMPtr<nsIChannel> channel;
|
nsCOMPtr<nsIChannel> channel;
|
||||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||||
mLoadingSrc,
|
aURI,
|
||||||
nsnull,
|
nsnull,
|
||||||
loadGroup,
|
loadGroup,
|
||||||
nsnull,
|
nsnull,
|
||||||
|
@ -961,7 +949,7 @@ nsresult nsHTMLMediaElement::LoadResource()
|
||||||
} else {
|
} else {
|
||||||
rv = nsContentUtils::GetSecurityManager()->
|
rv = nsContentUtils::GetSecurityManager()->
|
||||||
CheckLoadURIWithPrincipal(NodePrincipal(),
|
CheckLoadURIWithPrincipal(NodePrincipal(),
|
||||||
mLoadingSrc,
|
aURI,
|
||||||
nsIScriptSecurityManager::STANDARD);
|
nsIScriptSecurityManager::STANDARD);
|
||||||
listener = loadListener;
|
listener = loadListener;
|
||||||
}
|
}
|
||||||
|
@ -1003,11 +991,9 @@ nsresult nsHTMLMediaElement::LoadWithChannel(nsIChannel *aChannel,
|
||||||
|
|
||||||
AbortExistingLoads();
|
AbortExistingLoads();
|
||||||
|
|
||||||
nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(mLoadingSrc));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
ChangeDelayLoadStatus(true);
|
ChangeDelayLoadStatus(true);
|
||||||
rv = InitializeDecoderForChannel(aChannel, aListener);
|
|
||||||
|
nsresult rv = InitializeDecoderForChannel(aChannel, aListener);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
ChangeDelayLoadStatus(false);
|
ChangeDelayLoadStatus(false);
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1031,7 +1017,6 @@ NS_IMETHODIMP nsHTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther)
|
||||||
|
|
||||||
ChangeDelayLoadStatus(true);
|
ChangeDelayLoadStatus(true);
|
||||||
|
|
||||||
mLoadingSrc = other->mLoadingSrc;
|
|
||||||
nsresult rv = InitializeDecoderAsClone(other->mDecoder);
|
nsresult rv = InitializeDecoderAsClone(other->mDecoder);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
ChangeDelayLoadStatus(false);
|
ChangeDelayLoadStatus(false);
|
||||||
|
@ -1256,76 +1241,6 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(bool aMuted)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MediaElementSetForURI : public nsURIHashKey {
|
|
||||||
public:
|
|
||||||
MediaElementSetForURI(const nsIURI* aKey) : nsURIHashKey(aKey) {}
|
|
||||||
MediaElementSetForURI(const MediaElementSetForURI& toCopy)
|
|
||||||
: nsURIHashKey(toCopy), mElements(toCopy.mElements) {}
|
|
||||||
nsTArray<nsHTMLMediaElement*> mElements;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef nsTHashtable<MediaElementSetForURI> MediaElementURITable;
|
|
||||||
// Elements in this table must have non-null mDecoder and mLoadingSrc, and those
|
|
||||||
// can't change while the element is in the table. The table is keyed by
|
|
||||||
// the element's mLoadingSrc. Each entry has a list of all elements with the
|
|
||||||
// same mLoadingSrc.
|
|
||||||
static MediaElementURITable* gElementTable;
|
|
||||||
|
|
||||||
void
|
|
||||||
nsHTMLMediaElement::AddMediaElementToURITable()
|
|
||||||
{
|
|
||||||
NS_ASSERTION(mDecoder && mDecoder->GetStream(), "Call this only with decoder Load called");
|
|
||||||
if (!gElementTable) {
|
|
||||||
gElementTable = new MediaElementURITable();
|
|
||||||
gElementTable->Init();
|
|
||||||
}
|
|
||||||
MediaElementSetForURI* entry = gElementTable->PutEntry(mLoadingSrc);
|
|
||||||
entry->mElements.AppendElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsHTMLMediaElement::RemoveMediaElementFromURITable()
|
|
||||||
{
|
|
||||||
NS_ASSERTION(mDecoder, "Don't call this without decoder!");
|
|
||||||
NS_ASSERTION(mLoadingSrc, "Can't have decoder without source!");
|
|
||||||
if (!gElementTable)
|
|
||||||
return;
|
|
||||||
MediaElementSetForURI* entry = gElementTable->GetEntry(mLoadingSrc);
|
|
||||||
if (!entry)
|
|
||||||
return;
|
|
||||||
entry->mElements.RemoveElement(this);
|
|
||||||
if (entry->mElements.IsEmpty()) {
|
|
||||||
gElementTable->RemoveEntry(mLoadingSrc);
|
|
||||||
if (gElementTable->Count() == 0) {
|
|
||||||
delete gElementTable;
|
|
||||||
gElementTable = nsnull;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsHTMLMediaElement*
|
|
||||||
nsHTMLMediaElement::LookupMediaElementURITable(nsIURI* aURI)
|
|
||||||
{
|
|
||||||
if (!gElementTable)
|
|
||||||
return nsnull;
|
|
||||||
MediaElementSetForURI* entry = gElementTable->GetEntry(aURI);
|
|
||||||
if (!entry)
|
|
||||||
return nsnull;
|
|
||||||
for (PRUint32 i = 0; i < entry->mElements.Length(); ++i) {
|
|
||||||
nsHTMLMediaElement* elem = entry->mElements[i];
|
|
||||||
bool equal;
|
|
||||||
// Look for elements that have the same principal.
|
|
||||||
// XXX when we implement crossorigin for video, we'll also need to check
|
|
||||||
// for the same crossorigin mode here. Ditto for anything else that could
|
|
||||||
// cause us to send different headers.
|
|
||||||
if (NS_SUCCEEDED(elem->NodePrincipal()->Equals(NodePrincipal(), &equal)) && equal) {
|
|
||||||
NS_ASSERTION(elem->mDecoder && elem->mDecoder->GetStream(), "Decoder gone");
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nsnull;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||||
: nsGenericHTMLElement(aNodeInfo),
|
: nsGenericHTMLElement(aNodeInfo),
|
||||||
mCurrentLoadID(0),
|
mCurrentLoadID(0),
|
||||||
|
@ -1382,14 +1297,16 @@ nsHTMLMediaElement::~nsHTMLMediaElement()
|
||||||
|
|
||||||
UnregisterFreezableElement();
|
UnregisterFreezableElement();
|
||||||
if (mDecoder) {
|
if (mDecoder) {
|
||||||
RemoveMediaElementFromURITable();
|
|
||||||
mDecoder->Shutdown();
|
mDecoder->Shutdown();
|
||||||
|
mDecoder = nsnull;
|
||||||
}
|
}
|
||||||
if (mChannel) {
|
if (mChannel) {
|
||||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||||
|
mChannel = nsnull;
|
||||||
}
|
}
|
||||||
if (mAudioStream) {
|
if (mAudioStream) {
|
||||||
mAudioStream->Shutdown();
|
mAudioStream->Shutdown();
|
||||||
|
mAudioStream = nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1430,13 +1347,9 @@ NS_IMETHODIMP nsHTMLMediaElement::Play()
|
||||||
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
|
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
|
||||||
nsresult rv = Load();
|
nsresult rv = Load();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
} else if (mLoadIsSuspended) {
|
||||||
if (mLoadIsSuspended) {
|
|
||||||
ResumeLoad(PRELOAD_ENOUGH);
|
ResumeLoad(PRELOAD_ENOUGH);
|
||||||
}
|
} else if (mDecoder) {
|
||||||
// Even if we just did Load() or ResumeLoad(), we could already have a decoder
|
|
||||||
// here if we managed to clone an existing decoder.
|
|
||||||
if (mDecoder) {
|
|
||||||
if (mDecoder->IsEnded()) {
|
if (mDecoder->IsEnded()) {
|
||||||
SetCurrentTime(0);
|
SetCurrentTime(0);
|
||||||
}
|
}
|
||||||
|
@ -1898,9 +1811,7 @@ nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
|
||||||
|
|
||||||
nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
|
nsMediaStream* originalStream = aOriginal->GetCurrentStream();
|
||||||
|
|
||||||
nsMediaStream* originalStream = aOriginal->GetStream();
|
|
||||||
if (!originalStream)
|
if (!originalStream)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
nsRefPtr<nsMediaDecoder> decoder = aOriginal->Clone();
|
nsRefPtr<nsMediaDecoder> decoder = aOriginal->Clone();
|
||||||
|
@ -1937,8 +1848,6 @@ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
||||||
nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel,
|
nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel,
|
||||||
nsIStreamListener **aListener)
|
nsIStreamListener **aListener)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
|
|
||||||
|
|
||||||
nsCAutoString mimeType;
|
nsCAutoString mimeType;
|
||||||
aChannel->GetContentType(mimeType);
|
aChannel->GetContentType(mimeType);
|
||||||
|
|
||||||
|
@ -1969,10 +1878,10 @@ nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel,
|
||||||
|
|
||||||
nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder)
|
nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mLoadingSrc, "mLoadingSrc set up");
|
|
||||||
|
|
||||||
mDecoder = aDecoder;
|
mDecoder = aDecoder;
|
||||||
AddMediaElementToURITable();
|
|
||||||
|
// Decoder has assumed ownership responsibility for remembering the URI.
|
||||||
|
mLoadingSrc = nsnull;
|
||||||
|
|
||||||
// Force a same-origin check before allowing events for this media resource.
|
// Force a same-origin check before allowing events for this media resource.
|
||||||
mMediaSecurityVerified = false;
|
mMediaSecurityVerified = false;
|
||||||
|
@ -2110,11 +2019,9 @@ void nsHTMLMediaElement::NetworkError()
|
||||||
void nsHTMLMediaElement::DecodeError()
|
void nsHTMLMediaElement::DecodeError()
|
||||||
{
|
{
|
||||||
if (mDecoder) {
|
if (mDecoder) {
|
||||||
RemoveMediaElementFromURITable();
|
|
||||||
mDecoder->Shutdown();
|
mDecoder->Shutdown();
|
||||||
mDecoder = nsnull;
|
mDecoder = nsnull;
|
||||||
}
|
}
|
||||||
mLoadingSrc = nsnull;
|
|
||||||
if (mIsLoadingFromSourceChildren) {
|
if (mIsLoadingFromSourceChildren) {
|
||||||
mError = nsnull;
|
mError = nsnull;
|
||||||
if (mSourceLoadCandidate) {
|
if (mSourceLoadCandidate) {
|
||||||
|
@ -2762,10 +2669,13 @@ void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic)
|
||||||
|
|
||||||
void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString)
|
void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString)
|
||||||
{
|
{
|
||||||
if (mLoadingSrc) {
|
if (mDecoder) {
|
||||||
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
|
if (stream) {
|
||||||
|
stream->URI()->GetSpec(aString);
|
||||||
|
}
|
||||||
|
} else if (mLoadingSrc) {
|
||||||
mLoadingSrc->GetSpec(aString);
|
mLoadingSrc->GetSpec(aString);
|
||||||
} else {
|
|
||||||
aString.Truncate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,7 +377,7 @@ double nsBuiltinDecoder::GetCurrentTime()
|
||||||
return mCurrentTime;
|
return mCurrentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMediaStream* nsBuiltinDecoder::GetStream()
|
nsMediaStream* nsBuiltinDecoder::GetCurrentStream()
|
||||||
{
|
{
|
||||||
return mStream;
|
return mStream;
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,7 +405,7 @@ class nsBuiltinDecoder : public nsMediaDecoder
|
||||||
virtual void SetInfinite(bool aInfinite);
|
virtual void SetInfinite(bool aInfinite);
|
||||||
virtual bool IsInfinite();
|
virtual bool IsInfinite();
|
||||||
|
|
||||||
virtual nsMediaStream* GetStream();
|
virtual nsMediaStream* GetCurrentStream();
|
||||||
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal();
|
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal();
|
||||||
|
|
||||||
virtual void NotifySuspendedStatusChanged();
|
virtual void NotifySuspendedStatusChanged();
|
||||||
|
|
|
@ -1594,7 +1594,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine()
|
||||||
{
|
{
|
||||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||||
|
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(stream, NS_ERROR_NULL_POINTER);
|
||||||
|
|
||||||
switch (mState) {
|
switch (mState) {
|
||||||
|
@ -1675,7 +1675,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine()
|
||||||
// data to begin playback, or if we've not downloaded a reasonable
|
// data to begin playback, or if we've not downloaded a reasonable
|
||||||
// amount of data inside our buffering time.
|
// amount of data inside our buffering time.
|
||||||
TimeDuration elapsed = now - mBufferingStart;
|
TimeDuration elapsed = now - mBufferingStart;
|
||||||
bool isLiveStream = mDecoder->GetStream()->GetLength() == -1;
|
bool isLiveStream = mDecoder->GetCurrentStream()->GetLength() == -1;
|
||||||
if ((isLiveStream || !mDecoder->CanPlayThrough()) &&
|
if ((isLiveStream || !mDecoder->CanPlayThrough()) &&
|
||||||
elapsed < TimeDuration::FromSeconds(mBufferingWait) &&
|
elapsed < TimeDuration::FromSeconds(mBufferingWait) &&
|
||||||
(mQuickBuffering ? HasLowDecodedData(QUICK_BUFFERING_LOW_DATA_USECS)
|
(mQuickBuffering ? HasLowDecodedData(QUICK_BUFFERING_LOW_DATA_USECS)
|
||||||
|
@ -1873,7 +1873,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
||||||
|
|
||||||
// Check to see if we don't have enough data to play up to the next frame.
|
// Check to see if we don't have enough data to play up to the next frame.
|
||||||
// If we don't, switch to buffering mode.
|
// If we don't, switch to buffering mode.
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
if (mState == DECODER_STATE_DECODING &&
|
if (mState == DECODER_STATE_DECODING &&
|
||||||
mDecoder->GetState() == nsBuiltinDecoder::PLAY_STATE_PLAYING &&
|
mDecoder->GetState() == nsBuiltinDecoder::PLAY_STATE_PLAYING &&
|
||||||
HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) &&
|
HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) &&
|
||||||
|
@ -2051,7 +2051,7 @@ void nsBuiltinDecoderStateMachine::StartBuffering()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsBuiltinDecoderStateMachine::GetBuffered(nsTimeRanges* aBuffered) {
|
nsresult nsBuiltinDecoderStateMachine::GetBuffered(nsTimeRanges* aBuffered) {
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(stream, NS_ERROR_FAILURE);
|
||||||
stream->Pin();
|
stream->Pin();
|
||||||
nsresult res = mReader->GetBuffered(aBuffered, mStartTime);
|
nsresult res = mReader->GetBuffered(aBuffered, mStartTime);
|
||||||
|
|
|
@ -261,7 +261,7 @@ double nsMediaDecoder::GetFrameDelay()
|
||||||
|
|
||||||
void nsMediaDecoder::PinForSeek()
|
void nsMediaDecoder::PinForSeek()
|
||||||
{
|
{
|
||||||
nsMediaStream* stream = GetStream();
|
nsMediaStream* stream = GetCurrentStream();
|
||||||
if (!stream || mPinnedForSeek) {
|
if (!stream || mPinnedForSeek) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ void nsMediaDecoder::PinForSeek()
|
||||||
|
|
||||||
void nsMediaDecoder::UnpinForSeek()
|
void nsMediaDecoder::UnpinForSeek()
|
||||||
{
|
{
|
||||||
nsMediaStream* stream = GetStream();
|
nsMediaStream* stream = GetCurrentStream();
|
||||||
if (!stream || !mPinnedForSeek) {
|
if (!stream || !mPinnedForSeek) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,8 @@ public:
|
||||||
virtual bool Init(nsHTMLMediaElement* aElement);
|
virtual bool Init(nsHTMLMediaElement* aElement);
|
||||||
|
|
||||||
// Get the current nsMediaStream being used. Its URI will be returned
|
// Get the current nsMediaStream being used. Its URI will be returned
|
||||||
// by currentSrc. Returns what was passed to Load(), if Load() has been called.
|
// by currentSrc.
|
||||||
virtual nsMediaStream* GetStream() = 0;
|
virtual nsMediaStream* GetCurrentStream() = 0;
|
||||||
|
|
||||||
// Return the principal of the current URI being played or downloaded.
|
// Return the principal of the current URI being played or downloaded.
|
||||||
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() = 0;
|
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() = 0;
|
||||||
|
|
|
@ -169,7 +169,7 @@ public:
|
||||||
|
|
||||||
// The following can be called on the main thread only:
|
// The following can be called on the main thread only:
|
||||||
// Get the URI
|
// Get the URI
|
||||||
nsIURI* URI() const { return mURI; }
|
nsIURI* URI() { return mURI; }
|
||||||
// Close the stream, stop any listeners, channels, etc.
|
// Close the stream, stop any listeners, channels, etc.
|
||||||
// Cancels any currently blocking Read request and forces that request to
|
// Cancels any currently blocking Read request and forces that request to
|
||||||
// return an error.
|
// return an error.
|
||||||
|
|
|
@ -315,7 +315,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||||
{
|
{
|
||||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||||
|
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
if (mDecoder->GetStateMachine()->GetDuration() == -1 &&
|
if (mDecoder->GetStateMachine()->GetDuration() == -1 &&
|
||||||
mDecoder->GetStateMachine()->GetState() != nsDecoderStateMachine::DECODER_STATE_SHUTDOWN &&
|
mDecoder->GetStateMachine()->GetState() != nsDecoderStateMachine::DECODER_STATE_SHUTDOWN &&
|
||||||
stream->GetLength() >= 0 &&
|
stream->GetLength() >= 0 &&
|
||||||
|
@ -552,7 +552,7 @@ PRInt64 nsOggReader::ReadOggPage(ogg_page* aPage)
|
||||||
// Read from the stream into the buffer
|
// Read from the stream into the buffer
|
||||||
PRUint32 bytesRead = 0;
|
PRUint32 bytesRead = 0;
|
||||||
|
|
||||||
nsresult rv = mDecoder->GetStream()->Read(buffer, 4096, &bytesRead);
|
nsresult rv = mDecoder->GetCurrentStream()->Read(buffer, 4096, &bytesRead);
|
||||||
if (NS_FAILED(rv) || (bytesRead == 0 && ret == 0)) {
|
if (NS_FAILED(rv) || (bytesRead == 0 && ret == 0)) {
|
||||||
// End of file.
|
// End of file.
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -616,7 +616,7 @@ GetChecksum(ogg_page* page)
|
||||||
PRInt64 nsOggReader::RangeStartTime(PRInt64 aOffset)
|
PRInt64 nsOggReader::RangeStartTime(PRInt64 aOffset)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream != nsnull, nsnull);
|
NS_ENSURE_TRUE(stream != nsnull, nsnull);
|
||||||
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
||||||
NS_ENSURE_SUCCESS(res, nsnull);
|
NS_ENSURE_SUCCESS(res, nsnull);
|
||||||
|
@ -640,7 +640,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aEndOffset)
|
||||||
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
|
||||||
"Should be on state machine or decode thread.");
|
"Should be on state machine or decode thread.");
|
||||||
|
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream != nsnull, -1);
|
NS_ENSURE_TRUE(stream != nsnull, -1);
|
||||||
PRInt64 position = stream->Tell();
|
PRInt64 position = stream->Tell();
|
||||||
PRInt64 endTime = RangeEndTime(0, aEndOffset, false);
|
PRInt64 endTime = RangeEndTime(0, aEndOffset, false);
|
||||||
|
@ -653,7 +653,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
|
||||||
PRInt64 aEndOffset,
|
PRInt64 aEndOffset,
|
||||||
bool aCachedDataOnly)
|
bool aCachedDataOnly)
|
||||||
{
|
{
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
nsAutoOggSyncState sync;
|
nsAutoOggSyncState sync;
|
||||||
|
|
||||||
// We need to find the last page which ends before aEndOffset that
|
// We need to find the last page which ends before aEndOffset that
|
||||||
|
@ -770,7 +770,7 @@ nsresult nsOggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||||
nsTArray<nsByteRange> cached;
|
nsTArray<nsByteRange> cached;
|
||||||
nsresult res = mDecoder->GetStream()->GetCachedRanges(cached);
|
nsresult res = mDecoder->GetCurrentStream()->GetCachedRanges(cached);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
|
||||||
for (PRUint32 index = 0; index < cached.Length(); index++) {
|
for (PRUint32 index = 0; index < cached.Length(); index++) {
|
||||||
|
@ -809,7 +809,7 @@ nsOggReader::SelectSeekRange(const nsTArray<SeekRange>& ranges,
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||||
PRInt64 so = 0;
|
PRInt64 so = 0;
|
||||||
PRInt64 eo = mDecoder->GetStream()->GetLength();
|
PRInt64 eo = mDecoder->GetCurrentStream()->GetLength();
|
||||||
PRInt64 st = aStartTime;
|
PRInt64 st = aStartTime;
|
||||||
PRInt64 et = aEndTime;
|
PRInt64 et = aEndTime;
|
||||||
for (PRUint32 i = 0; i < ranges.Length(); i++) {
|
for (PRUint32 i = 0; i < ranges.Length(); i++) {
|
||||||
|
@ -837,7 +837,7 @@ nsOggReader::SelectSeekRange(const nsTArray<SeekRange>& ranges,
|
||||||
nsOggReader::IndexedSeekResult nsOggReader::RollbackIndexedSeek(PRInt64 aOffset)
|
nsOggReader::IndexedSeekResult nsOggReader::RollbackIndexedSeek(PRInt64 aOffset)
|
||||||
{
|
{
|
||||||
mSkeletonState->Deactivate();
|
mSkeletonState->Deactivate();
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream != nsnull, SEEK_FATAL_ERROR);
|
NS_ENSURE_TRUE(stream != nsnull, SEEK_FATAL_ERROR);
|
||||||
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
||||||
NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR);
|
NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR);
|
||||||
|
@ -846,7 +846,7 @@ nsOggReader::IndexedSeekResult nsOggReader::RollbackIndexedSeek(PRInt64 aOffset)
|
||||||
|
|
||||||
nsOggReader::IndexedSeekResult nsOggReader::SeekToKeyframeUsingIndex(PRInt64 aTarget)
|
nsOggReader::IndexedSeekResult nsOggReader::SeekToKeyframeUsingIndex(PRInt64 aTarget)
|
||||||
{
|
{
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream != nsnull, SEEK_FATAL_ERROR);
|
NS_ENSURE_TRUE(stream != nsnull, SEEK_FATAL_ERROR);
|
||||||
if (!HasSkeleton() || !mSkeletonState->HasIndex()) {
|
if (!HasSkeleton() || !mSkeletonState->HasIndex()) {
|
||||||
return SEEK_INDEX_FAIL;
|
return SEEK_INDEX_FAIL;
|
||||||
|
@ -1014,7 +1014,7 @@ nsresult nsOggReader::Seek(PRInt64 aTarget,
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||||
LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
|
LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
|
||||||
nsresult res;
|
nsresult res;
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
NS_ENSURE_TRUE(stream != nsnull, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(stream != nsnull, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (aTarget == aStartTime) {
|
if (aTarget == aStartTime) {
|
||||||
|
@ -1139,7 +1139,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||||
nsresult res;
|
nsresult res;
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
|
|
||||||
if (aTarget == aRange.mTimeStart) {
|
if (aTarget == aRange.mTimeStart) {
|
||||||
if (NS_FAILED(ResetDecode())) {
|
if (NS_FAILED(ResetDecode())) {
|
||||||
|
@ -1407,7 +1407,7 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
nsTArray<nsByteRange> ranges;
|
nsTArray<nsByteRange> ranges;
|
||||||
nsresult res = stream->GetCachedRanges(ranges);
|
nsresult res = stream->GetCachedRanges(ranges);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
|
|
@ -73,7 +73,6 @@ _TEST_FILES = \
|
||||||
can_play_type_webm.js \
|
can_play_type_webm.js \
|
||||||
cancellable_request.sjs \
|
cancellable_request.sjs \
|
||||||
dynamic_redirect.sjs \
|
dynamic_redirect.sjs \
|
||||||
dynamic_resource.sjs \
|
|
||||||
file_access_controls.html \
|
file_access_controls.html \
|
||||||
fragment_play.js \
|
fragment_play.js \
|
||||||
fragment_noplay.js \
|
fragment_noplay.js \
|
||||||
|
@ -121,7 +120,6 @@ _TEST_FILES = \
|
||||||
test_info_leak.html \
|
test_info_leak.html \
|
||||||
test_load.html \
|
test_load.html \
|
||||||
test_load_candidates.html \
|
test_load_candidates.html \
|
||||||
test_load_same_resource.html \
|
|
||||||
test_load_source.html \
|
test_load_source.html \
|
||||||
test_loop.html \
|
test_loop.html \
|
||||||
test_media_selection.html \
|
test_media_selection.html \
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
// Return resource1 file content for the first request with a given key.
|
|
||||||
// All subsequent requests return resource2. Both must be video/ogg.
|
|
||||||
function handleRequest(request, response)
|
|
||||||
{
|
|
||||||
var key = (request.queryString.match(/^key=([^&]*)&/))[1];
|
|
||||||
var resource1 = (request.queryString.match(/res1=([^&]*)/))[1];
|
|
||||||
var resource2 = (request.queryString.match(/res2=([^&]*)/))[1];
|
|
||||||
|
|
||||||
var resource = getState(key) == "2" ? resource2 : resource1;
|
|
||||||
setState(key, "2");
|
|
||||||
|
|
||||||
var file = Components.classes["@mozilla.org/file/directory_service;1"].
|
|
||||||
getService(Components.interfaces.nsIProperties).
|
|
||||||
get("CurWorkD", Components.interfaces.nsILocalFile);
|
|
||||||
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
|
|
||||||
createInstance(Components.interfaces.nsIFileInputStream);
|
|
||||||
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
|
|
||||||
createInstance(Components.interfaces.nsIBinaryInputStream);
|
|
||||||
var paths = "tests/content/media/test/" + resource;
|
|
||||||
var split = paths.split("/");
|
|
||||||
for(var i = 0; i < split.length; ++i) {
|
|
||||||
file.append(split[i]);
|
|
||||||
}
|
|
||||||
fis.init(file, -1, -1, false);
|
|
||||||
dump("file=" + file + "\n");
|
|
||||||
bis.setInputStream(fis);
|
|
||||||
var bytes = bis.readBytes(bis.available());
|
|
||||||
response.setStatusLine(request.httpVersion, 206, "Partial Content");
|
|
||||||
response.setHeader("Content-Range", "bytes 0-" + (bytes.length - 1) + "/" + bytes.length);
|
|
||||||
response.setHeader("Content-Length", ""+bytes.length, false);
|
|
||||||
response.setHeader("Content-Type", "video/ogg", false);
|
|
||||||
response.write(bytes, bytes.length);
|
|
||||||
bis.close();
|
|
||||||
}
|
|
|
@ -25,13 +25,9 @@ var gProgressTests = [
|
||||||
|
|
||||||
// Used by test_mozLoadFrom. Need one test file per decoder backend, plus
|
// Used by test_mozLoadFrom. Need one test file per decoder backend, plus
|
||||||
// anything for testing clone-specific bugs.
|
// anything for testing clone-specific bugs.
|
||||||
var cloneKey = Math.floor(Math.random()*100000000);
|
|
||||||
var gCloneTests = gSmallTests.concat([
|
var gCloneTests = gSmallTests.concat([
|
||||||
// Actual duration is ~200ms, we have Content-Duration lie about it.
|
// Actual duration is ~200ms, we have Content-Duration lie about it.
|
||||||
{ name:"bug520908.ogv", type:"video/ogg", duration:9000 },
|
{ name:"bug520908.ogv", type:"video/ogg", duration:9000 },
|
||||||
// short-video is more like 1s, so if you load this twice you'll get an unexpected duration
|
|
||||||
{ name:"dynamic_resource.sjs?key=" + cloneKey + "&res1=320x240.ogv&res2=short-video.ogv",
|
|
||||||
type:"video/ogg", duration:0.233 },
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Used by test_play_twice. Need one test file per decoder backend, plus
|
// Used by test_play_twice. Need one test file per decoder backend, plus
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Test loading of the same resource in multiple elements</title>
|
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
||||||
<script type="text/javascript" src="manifest.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<pre id="test">
|
|
||||||
<script class="testbody" type="text/javascript">
|
|
||||||
|
|
||||||
var manager = new MediaTestManager;
|
|
||||||
|
|
||||||
function cloneLoaded(event) {
|
|
||||||
ok(true, "Clone loaded OK");
|
|
||||||
var e = event.target;
|
|
||||||
|
|
||||||
if (e._expectedDuration) {
|
|
||||||
ok(Math.abs(e.duration - e._expectedDuration) < 0.1,
|
|
||||||
"Clone " + e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
manager.finished(e.token);
|
|
||||||
}
|
|
||||||
|
|
||||||
function tryClone(event) {
|
|
||||||
var e = event.target;
|
|
||||||
var clone = e.cloneNode(false);
|
|
||||||
clone.token = e.token;
|
|
||||||
|
|
||||||
if (e._expectedDuration) {
|
|
||||||
ok(Math.abs(e.duration - e._expectedDuration) < 0.1,
|
|
||||||
e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);
|
|
||||||
clone._expectedDuration = e._expectedDuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
clone.addEventListener("loadeddata", cloneLoaded, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This test checks that loading the same URI twice in different elements at the same time
|
|
||||||
// uses the same resource without doing another network fetch. One of the gCloneTests
|
|
||||||
// uses dynamic_resource.sjs to return one resource on the first fetch and a different resource
|
|
||||||
// on the second fetch. These resources have different lengths, so if the cloned element
|
|
||||||
// does a network fetch it will get a resource with the wrong length and we get a test
|
|
||||||
// failure.
|
|
||||||
|
|
||||||
function initTest(test, token) {
|
|
||||||
var elemType = /^audio/.test(test.type) ? "audio" : "video";
|
|
||||||
var e = document.createElement(elemType);
|
|
||||||
if (e.canPlayType(test.type)) {
|
|
||||||
e.src = test.name;
|
|
||||||
if (test.duration) {
|
|
||||||
e._expectedDuration = test.duration;
|
|
||||||
}
|
|
||||||
ok(true, "Trying to load " + test.name);
|
|
||||||
e.addEventListener("loadeddata", tryClone, false);
|
|
||||||
e.load();
|
|
||||||
e.token = token;
|
|
||||||
manager.started(token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manager.runTests(gCloneTests, initTest);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -30,7 +30,6 @@ manager.onFinished = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var test = getPlayableVideo(gSeekTests);
|
var test = getPlayableVideo(gSeekTests);
|
||||||
var baseName = test.name;
|
|
||||||
var gTest = test;
|
var gTest = test;
|
||||||
var bogusSrc = "bogus.duh";
|
var bogusSrc = "bogus.duh";
|
||||||
var bogusType = "video/bogus";
|
var bogusType = "video/bogus";
|
||||||
|
@ -145,9 +144,8 @@ var tests = [
|
||||||
suspend:
|
suspend:
|
||||||
function(e) {
|
function(e) {
|
||||||
var v = e.target;
|
var v = e.target;
|
||||||
if (v._gotSuspend) {
|
if (v._gotSuspend)
|
||||||
return; // We can receive multiple suspend events, like the one after download completes.
|
return; // We can receive multiple suspend events, like the one after download completes.
|
||||||
}
|
|
||||||
v._gotSuspend = true;
|
v._gotSuspend = true;
|
||||||
is(v._gotLoadStart, true, "(4) Must get loadstart.");
|
is(v._gotLoadStart, true, "(4) Must get loadstart.");
|
||||||
is(v._gotLoadedMetaData, false, "(4) Must not get loadedmetadata.");
|
is(v._gotLoadedMetaData, false, "(4) Must not get loadedmetadata.");
|
||||||
|
@ -559,23 +557,14 @@ var tests = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var iterationCount = 0;
|
|
||||||
function startTest(test, token) {
|
function startTest(test, token) {
|
||||||
if (test == tests[0]) {
|
|
||||||
++iterationCount;
|
|
||||||
}
|
|
||||||
if (iterationCount == 2) {
|
|
||||||
// Do this series of tests on logically different resources
|
|
||||||
test.name = baseName + "?" + Math.floor(Math.random()*100000);
|
|
||||||
}
|
|
||||||
var v = document.createElement("video");
|
var v = document.createElement("video");
|
||||||
v.token = token;
|
v.token = token;
|
||||||
test.setup(v);
|
test.setup(v);
|
||||||
manager.started(token);
|
manager.started(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
var twiceTests = tests.concat(tests);
|
manager.runTests(tests, startTest);
|
||||||
manager.runTests(twiceTests, startTest);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
@ -261,7 +261,7 @@ nsresult nsWaveReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTim
|
||||||
PRInt64 position = RoundDownToFrame(static_cast<PRInt64>(TimeToBytes(seekTime)));
|
PRInt64 position = RoundDownToFrame(static_cast<PRInt64>(TimeToBytes(seekTime)));
|
||||||
NS_ASSERTION(PR_INT64_MAX - mWavePCMOffset > position, "Integer overflow during wave seek");
|
NS_ASSERTION(PR_INT64_MAX - mWavePCMOffset > position, "Integer overflow during wave seek");
|
||||||
position += mWavePCMOffset;
|
position += mWavePCMOffset;
|
||||||
return mDecoder->GetStream()->Seek(nsISeekableStream::NS_SEEK_SET, position);
|
return mDecoder->GetCurrentStream()->Seek(nsISeekableStream::NS_SEEK_SET, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
static double RoundToUsecs(double aSeconds) {
|
static double RoundToUsecs(double aSeconds) {
|
||||||
|
@ -270,9 +270,9 @@ static double RoundToUsecs(double aSeconds) {
|
||||||
|
|
||||||
nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
||||||
{
|
{
|
||||||
PRInt64 startOffset = mDecoder->GetStream()->GetNextCachedData(mWavePCMOffset);
|
PRInt64 startOffset = mDecoder->GetCurrentStream()->GetNextCachedData(mWavePCMOffset);
|
||||||
while (startOffset >= 0) {
|
while (startOffset >= 0) {
|
||||||
PRInt64 endOffset = mDecoder->GetStream()->GetCachedDataEnd(startOffset);
|
PRInt64 endOffset = mDecoder->GetCurrentStream()->GetCachedDataEnd(startOffset);
|
||||||
// Bytes [startOffset..endOffset] are cached.
|
// Bytes [startOffset..endOffset] are cached.
|
||||||
NS_ASSERTION(startOffset >= mWavePCMOffset, "Integer underflow in GetBuffered");
|
NS_ASSERTION(startOffset >= mWavePCMOffset, "Integer underflow in GetBuffered");
|
||||||
NS_ASSERTION(endOffset >= mWavePCMOffset, "Integer underflow in GetBuffered");
|
NS_ASSERTION(endOffset >= mWavePCMOffset, "Integer underflow in GetBuffered");
|
||||||
|
@ -282,7 +282,7 @@ nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
||||||
// the media element.
|
// the media element.
|
||||||
aBuffered->Add(RoundToUsecs(BytesToTime(startOffset - mWavePCMOffset)),
|
aBuffered->Add(RoundToUsecs(BytesToTime(startOffset - mWavePCMOffset)),
|
||||||
RoundToUsecs(BytesToTime(endOffset - mWavePCMOffset)));
|
RoundToUsecs(BytesToTime(endOffset - mWavePCMOffset)));
|
||||||
startOffset = mDecoder->GetStream()->GetNextCachedData(endOffset);
|
startOffset = mDecoder->GetCurrentStream()->GetNextCachedData(endOffset);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ nsWaveReader::ReadAll(char* aBuf, PRInt64 aSize, PRInt64* aBytesRead)
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
PRUint32 read = 0;
|
PRUint32 read = 0;
|
||||||
if (NS_FAILED(mDecoder->GetStream()->Read(aBuf + got, PRUint32(aSize - got), &read))) {
|
if (NS_FAILED(mDecoder->GetCurrentStream()->Read(aBuf + got, PRUint32(aSize - got), &read))) {
|
||||||
NS_WARNING("Stream read failed");
|
NS_WARNING("Stream read failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ nsWaveReader::LoadRIFFChunk()
|
||||||
char riffHeader[RIFF_INITIAL_SIZE];
|
char riffHeader[RIFF_INITIAL_SIZE];
|
||||||
const char* p = riffHeader;
|
const char* p = riffHeader;
|
||||||
|
|
||||||
NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() == 0,
|
NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() == 0,
|
||||||
"LoadRIFFChunk called when stream in invalid state");
|
"LoadRIFFChunk called when stream in invalid state");
|
||||||
|
|
||||||
if (!ReadAll(riffHeader, sizeof(riffHeader))) {
|
if (!ReadAll(riffHeader, sizeof(riffHeader))) {
|
||||||
|
@ -390,7 +390,7 @@ nsWaveReader::LoadFormatChunk()
|
||||||
const char* p = waveFormat;
|
const char* p = waveFormat;
|
||||||
|
|
||||||
// RIFF chunks are always word (two byte) aligned.
|
// RIFF chunks are always word (two byte) aligned.
|
||||||
NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() % 2 == 0,
|
NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() % 2 == 0,
|
||||||
"LoadFormatChunk called with unaligned stream");
|
"LoadFormatChunk called with unaligned stream");
|
||||||
|
|
||||||
// The "format" chunk may not directly follow the "riff" chunk, so skip
|
// The "format" chunk may not directly follow the "riff" chunk, so skip
|
||||||
|
@ -455,7 +455,7 @@ nsWaveReader::LoadFormatChunk()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RIFF chunks are always word (two byte) aligned.
|
// RIFF chunks are always word (two byte) aligned.
|
||||||
NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() % 2 == 0,
|
NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() % 2 == 0,
|
||||||
"LoadFormatChunk left stream unaligned");
|
"LoadFormatChunk left stream unaligned");
|
||||||
|
|
||||||
// Make sure metadata is fairly sane. The rate check is fairly arbitrary,
|
// Make sure metadata is fairly sane. The rate check is fairly arbitrary,
|
||||||
|
@ -485,7 +485,7 @@ bool
|
||||||
nsWaveReader::FindDataOffset()
|
nsWaveReader::FindDataOffset()
|
||||||
{
|
{
|
||||||
// RIFF chunks are always word (two byte) aligned.
|
// RIFF chunks are always word (two byte) aligned.
|
||||||
NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() % 2 == 0,
|
NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() % 2 == 0,
|
||||||
"FindDataOffset called with unaligned stream");
|
"FindDataOffset called with unaligned stream");
|
||||||
|
|
||||||
// The "data" chunk may not directly follow the "format" chunk, so skip
|
// The "data" chunk may not directly follow the "format" chunk, so skip
|
||||||
|
@ -495,7 +495,7 @@ nsWaveReader::FindDataOffset()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt64 offset = mDecoder->GetStream()->Tell();
|
PRInt64 offset = mDecoder->GetCurrentStream()->Tell();
|
||||||
if (offset <= 0 || offset > PR_UINT32_MAX) {
|
if (offset <= 0 || offset > PR_UINT32_MAX) {
|
||||||
NS_WARNING("PCM data offset out of range");
|
NS_WARNING("PCM data offset out of range");
|
||||||
return false;
|
return false;
|
||||||
|
@ -535,7 +535,7 @@ nsWaveReader::GetDataLength()
|
||||||
// If the decoder has a valid content length, and it's shorter than the
|
// If the decoder has a valid content length, and it's shorter than the
|
||||||
// expected length of the PCM data, calculate the playback duration from
|
// expected length of the PCM data, calculate the playback duration from
|
||||||
// the content length rather than the expected PCM data length.
|
// the content length rather than the expected PCM data length.
|
||||||
PRInt64 streamLength = mDecoder->GetStream()->GetLength();
|
PRInt64 streamLength = mDecoder->GetCurrentStream()->GetLength();
|
||||||
if (streamLength >= 0) {
|
if (streamLength >= 0) {
|
||||||
PRInt64 dataLength = NS_MAX<PRInt64>(0, streamLength - mWavePCMOffset);
|
PRInt64 dataLength = NS_MAX<PRInt64>(0, streamLength - mWavePCMOffset);
|
||||||
length = NS_MIN(dataLength, length);
|
length = NS_MIN(dataLength, length);
|
||||||
|
@ -546,5 +546,5 @@ nsWaveReader::GetDataLength()
|
||||||
PRInt64
|
PRInt64
|
||||||
nsWaveReader::GetPosition()
|
nsWaveReader::GetPosition()
|
||||||
{
|
{
|
||||||
return mDecoder->GetStream()->Tell();
|
return mDecoder->GetCurrentStream()->Tell();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ static int webm_read(void *aBuffer, size_t aLength, void *aUserData)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder");
|
NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder");
|
||||||
nsBuiltinDecoder* decoder = reinterpret_cast<nsBuiltinDecoder*>(aUserData);
|
nsBuiltinDecoder* decoder = reinterpret_cast<nsBuiltinDecoder*>(aUserData);
|
||||||
nsMediaStream* stream = decoder->GetStream();
|
nsMediaStream* stream = decoder->GetCurrentStream();
|
||||||
NS_ASSERTION(stream, "Decoder has no media stream");
|
NS_ASSERTION(stream, "Decoder has no media stream");
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
@ -112,7 +112,7 @@ static int webm_seek(int64_t aOffset, int aWhence, void *aUserData)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder");
|
NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder");
|
||||||
nsBuiltinDecoder* decoder = reinterpret_cast<nsBuiltinDecoder*>(aUserData);
|
nsBuiltinDecoder* decoder = reinterpret_cast<nsBuiltinDecoder*>(aUserData);
|
||||||
nsMediaStream* stream = decoder->GetStream();
|
nsMediaStream* stream = decoder->GetCurrentStream();
|
||||||
NS_ASSERTION(stream, "Decoder has no media stream");
|
NS_ASSERTION(stream, "Decoder has no media stream");
|
||||||
nsresult rv = stream->Seek(aWhence, aOffset);
|
nsresult rv = stream->Seek(aWhence, aOffset);
|
||||||
return NS_SUCCEEDED(rv) ? 0 : -1;
|
return NS_SUCCEEDED(rv) ? 0 : -1;
|
||||||
|
@ -122,7 +122,7 @@ static int64_t webm_tell(void *aUserData)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder");
|
NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder");
|
||||||
nsBuiltinDecoder* decoder = reinterpret_cast<nsBuiltinDecoder*>(aUserData);
|
nsBuiltinDecoder* decoder = reinterpret_cast<nsBuiltinDecoder*>(aUserData);
|
||||||
nsMediaStream* stream = decoder->GetStream();
|
nsMediaStream* stream = decoder->GetCurrentStream();
|
||||||
NS_ASSERTION(stream, "Decoder has no media stream");
|
NS_ASSERTION(stream, "Decoder has no media stream");
|
||||||
return stream->Tell();
|
return stream->Tell();
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ nsReturnRef<NesteggPacketHolder> nsWebMReader::NextPacket(TrackType aTrackType)
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
return nsReturnRef<NesteggPacketHolder>();
|
return nsReturnRef<NesteggPacketHolder>();
|
||||||
}
|
}
|
||||||
PRInt64 offset = mDecoder->GetStream()->Tell();
|
PRInt64 offset = mDecoder->GetCurrentStream()->Tell();
|
||||||
holder.own(new NesteggPacketHolder(packet, offset));
|
holder.own(new NesteggPacketHolder(packet, offset));
|
||||||
|
|
||||||
unsigned int track = 0;
|
unsigned int track = 0;
|
||||||
|
@ -769,7 +769,7 @@ nsresult nsWebMReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTim
|
||||||
|
|
||||||
nsresult nsWebMReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
nsresult nsWebMReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
||||||
{
|
{
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
|
|
||||||
uint64_t timecodeScale;
|
uint64_t timecodeScale;
|
||||||
if (!mContext || nestegg_tstamp_scale(mContext, &timecodeScale) == -1) {
|
if (!mContext || nestegg_tstamp_scale(mContext, &timecodeScale) == -1) {
|
||||||
|
@ -783,7 +783,7 @@ nsresult nsWebMReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
||||||
aBuffered->Add(0, duration / NS_PER_S);
|
aBuffered->Add(0, duration / NS_PER_S);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nsMediaStream* stream = mDecoder->GetStream();
|
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||||
nsTArray<nsByteRange> ranges;
|
nsTArray<nsByteRange> ranges;
|
||||||
nsresult res = stream->GetCachedRanges(ranges);
|
nsresult res = stream->GetCachedRanges(ranges);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче