Bug 848651 - Part 2: Log an error to the Web Console if we run out of memory while trying to resample an AudioBuffer for playback; r=padenot

This commit is contained in:
Ehsan Akhgari 2013-03-08 11:49:56 -05:00
parent a06ea67f9d
commit fc32827507
2 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include "jsfriendapi.h"
#include "mozilla/ErrorResult.h"
#include "AudioSegment.h"
#include "nsIScriptError.h"
namespace mozilla {
namespace dom {
@ -190,6 +191,16 @@ AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext, uint32_t aRat
}
float* outputData = static_cast<float*>(malloc(uint32_t(size)));
if (!outputData) {
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(mContext->GetParentObject());
nsIDocument* doc = nullptr;
if (pWindow) {
doc = pWindow->GetExtantDoc();
}
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"Media",
doc,
nsContentUtils::eDOM_PROPERTIES,
"MediaBufferSourceNodeResampleOutOfMemory");
return mResampledChannels;
}

View File

@ -88,6 +88,7 @@ ResponseTypeSyncXHRWarning=Use of XMLHttpRequest's responseType attribute is no
WithCredentialsSyncXHRWarning=Use of XMLHttpRequest's withCredentials attribute is no longer supported in the synchronous mode in window context.
TimeoutSyncXHRWarning=Use of XMLHttpRequest's timeout attribute is not supported in the synchronous mode in window context.
JSONCharsetWarning=An attempt was made to declare a non-UTF-8 encoding for JSON retrieved using XMLHttpRequest. Only UTF-8 is supported for decoding JSON.
MediaBufferSourceNodeResampleOutOfMemory=Insufficient memory to resample the AudioBufferSourceNode for playback.
# LOCALIZATION NOTE: Do not translate decodeAudioData.
MediaDecodeAudioDataUnknownContentType=The buffer passed to decodeAudioData contains an unknown content type.
# LOCALIZATION NOTE: Do not translate decodeAudioData.