--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -921,17 +921,17 @@ nsDocShell::nsDocShell()
if (!gDocShellLog) {
gDocShellLog = PR_NewLogModule("nsDocShell");
}
#endif
if (!gDocShellLeakLog) {
gDocShellLeakLog = PR_NewLogModule("nsDocShellLeak");
}
if (gDocShellLeakLog) {
- MOZ_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p created\n", this));
+ MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this));
}
#ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks
++gNumberOfDocShells;
if (!PR_GetEnv("MOZ_QUIET")) {
printf_stderr("++DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
(void*)this,
@@ -953,17 +953,17 @@ nsDocShell::~nsDocShell()
shPrivate->SetRootDocShell(nullptr);
}
if (--gDocShellCount == 0) {
NS_IF_RELEASE(sURIFixup);
}
if (gDocShellLeakLog) {
- MOZ_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p destroyed\n", this));
+ MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p destroyed\n", this));
}
#ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks
--gNumberOfDocShells;
if (!PR_GetEnv("MOZ_QUIET")) {
printf_stderr("--DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
(void*)this,
@@ -1090,17 +1090,17 @@ nsDocShell::GetInterface(const nsIID& aI
nsCOMPtr<nsIDOMDocument> domDoc;
contentViewer->GetDOMDocument(getter_AddRefs(domDoc));
NS_ASSERTION(domDoc, "Should have a document.");
if (!domDoc) {
return NS_ERROR_NO_INTERFACE;
}
#if defined(DEBUG)
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
("nsDocShell[%p]: returning app cache container %p",
this, domDoc.get()));
#endif
return domDoc->QueryInterface(aIID, aSink);
} else if (aIID.Equals(NS_GET_IID(nsIPrompt)) &&
NS_SUCCEEDED(EnsureScriptEnvironment())) {
nsresult rv;
nsCOMPtr<nsIWindowWatcher> wwatch =
@@ -1413,20 +1413,20 @@ nsDocShell::LoadURI(nsIURI* aURI,
aLoadInfo->GetReferrerPolicy(&referrerPolicy);
aLoadInfo->GetIsSrcdocLoad(&isSrcdoc);
aLoadInfo->GetSrcdocData(srcdoc);
aLoadInfo->GetSourceDocShell(getter_AddRefs(sourceDocShell));
aLoadInfo->GetBaseURI(getter_AddRefs(baseURI));
}
#if defined(DEBUG)
- if (MOZ_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
nsAutoCString uristr;
aURI->GetAsciiSpec(uristr);
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
("nsDocShell[%p]: loading %s with flags 0x%08x",
this, uristr.get(), aLoadFlags));
}
#endif
if (!shEntry &&
!LOAD_TYPE_HAS_FLAGS(loadType, LOAD_FLAGS_REPLACE_HISTORY)) {
// First verify if this is a subframe.
@@ -1535,17 +1535,17 @@ nsDocShell::LoadURI(nsIURI* aURI,
if (inOnLoadHandler) {
loadType = LOAD_NORMAL_REPLACE;
}
}
} // !shEntry
if (shEntry) {
#ifdef DEBUG
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
("nsDocShell[%p]: loading from session history", this));
#endif
return LoadHistoryEntry(shEntry, loadType);
}
// On history navigation via Back/Forward buttons, don't execute
// automatic JavaScript redirection such as |location.href = ...| or
@@ -1975,17 +1975,17 @@ nsDocShell::SetCurrentURI(nsIURI* aURI)
SetCurrentURI(aURI, nullptr, true, 0);
return NS_OK;
}
bool
nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
bool aFireOnLocationChange, uint32_t aLocationFlags)
{
- if (gDocShellLeakLog && MOZ_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) {
+ if (gDocShellLeakLog && MOZ_LOG_TEST(gDocShellLeakLog, LogLevel::Debug)) {
nsAutoCString spec;
if (aURI) {
aURI->GetSpec(spec);
}
PR_LogPrint("DOCSHELL %p SetCurrentURI %s\n", this, spec.get());
}
// We don't want to send a location change when we're displaying an error
@@ -5297,28 +5297,28 @@ NS_IMETHODIMP
nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
const char* aErrorPage,
const char16_t* aErrorType,
const char16_t* aDescription,
const char* aCSSClass,
nsIChannel* aFailedChannel)
{
#if defined(DEBUG)
- if (MOZ_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
nsAutoCString spec;
aURI->GetSpec(spec);
nsAutoCString chanName;
if (aFailedChannel) {
aFailedChannel->GetName(chanName);
} else {
chanName.AssignLiteral("<no channel>");
}
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
("nsDocShell[%p]::LoadErrorPage(\"%s\", \"%s\", {...}, [%s])\n", this,
spec.get(), NS_ConvertUTF16toUTF8(aURL).get(), chanName.get()));
}
#endif
mFailedChannel = aFailedChannel;
mFailedURI = aURI;
mFailedLoadType = mLoadType;
@@ -9601,17 +9601,17 @@ nsDocShell::InternalLoad(nsIURI* aURI,
nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI,
nsIDocShell** aDocShell,
nsIRequest** aRequest)
{
nsresult rv = NS_OK;
mOriginalUriString.Truncate();
- if (gDocShellLeakLog && MOZ_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) {
+ if (gDocShellLeakLog && MOZ_LOG_TEST(gDocShellLeakLog, LogLevel::Debug)) {
nsAutoCString spec;
if (aURI) {
aURI->GetSpec(spec);
}
PR_LogPrint("DOCSHELL %p InternalLoad %s\n", this, spec.get());
}
// Initialize aDocShell/aRequest
if (aDocShell) {
@@ -11160,28 +11160,28 @@ bool
nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
uint32_t aLoadType, bool aFireOnLocationChange,
bool aAddToGlobalHistory, bool aCloneSHChildren)
{
NS_PRECONDITION(aURI, "uri is null");
NS_PRECONDITION(!aChannel || !aOwner, "Shouldn't have both set");
#if defined(DEBUG)
- if (MOZ_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
nsAutoCString spec;
aURI->GetSpec(spec);
nsAutoCString chanName;
if (aChannel) {
aChannel->GetName(chanName);
} else {
chanName.AssignLiteral("<no channel>");
}
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
("nsDocShell[%p]::OnNewURI(\"%s\", [%s], 0x%x)\n", this, spec.get(),
chanName.get(), aLoadType));
}
#endif
bool equalUri = false;
// Get the post data and the HTTP response code from the channel.
@@ -11236,17 +11236,17 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsICh
}
#ifdef DEBUG
bool shAvailable = (rootSH != nullptr);
// XXX This log message is almost useless because |updateSHistory|
// and |updateGHistory| are not correct at this point.
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
(" shAvailable=%i updateSHistory=%i updateGHistory=%i"
" equalURI=%i\n",
shAvailable, updateSHistory, updateGHistory, equalUri));
if (shAvailable && mCurrentURI && !mOSHE && aLoadType != LOAD_ERROR_PAGE) {
NS_ASSERTION(NS_IsAboutBlank(mCurrentURI),
"no SHEntry for a non-transient viewer?");
}
@@ -11780,28 +11780,28 @@ nsresult
nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
nsISupports* aOwner, bool aCloneChildren,
nsISHEntry** aNewEntry)
{
NS_PRECONDITION(aURI, "uri is null");
NS_PRECONDITION(!aChannel || !aOwner, "Shouldn't have both set");
#if defined(DEBUG)
- if (MOZ_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
nsAutoCString spec;
aURI->GetSpec(spec);
nsAutoCString chanName;
if (aChannel) {
aChannel->GetName(chanName);
} else {
chanName.AssignLiteral("<no channel>");
}
- MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocShellLog, LogLevel::Debug,
("nsDocShell[%p]::AddToSessionHistory(\"%s\", [%s])\n",
this, spec.get(), chanName.get()));
}
#endif
nsresult rv = NS_OK;
nsCOMPtr<nsISHEntry> entry;
bool shouldPersist;
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -63,27 +63,27 @@ static PRLogModuleInfo*
GetSHistoryLog()
{
static PRLogModuleInfo* sLog;
if (!sLog) {
sLog = PR_NewLogModule("nsSHistory");
}
return sLog;
}
-#define LOG(format) MOZ_LOG(GetSHistoryLog(), PR_LOG_DEBUG, format)
+#define LOG(format) MOZ_LOG(GetSHistoryLog(), mozilla::LogLevel::Debug, format)
// This macro makes it easier to print a log message which includes a URI's
// spec. Example use:
//
// nsIURI *uri = [...];
// LOG_SPEC(("The URI is %s.", _spec), uri);
//
#define LOG_SPEC(format, uri) \
PR_BEGIN_MACRO \
- if (MOZ_LOG_TEST(GetSHistoryLog(), PR_LOG_DEBUG)) { \
+ if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) { \
nsAutoCString _specStr(NS_LITERAL_CSTRING("(null)"));\
if (uri) { \
uri->GetSpec(_specStr); \
} \
const char* _spec = _specStr.get(); \
LOG(format); \
} \
PR_END_MACRO
@@ -91,17 +91,17 @@ GetSHistoryLog()
// This macro makes it easy to log a message including an SHEntry's URI.
// For example:
//
// nsCOMPtr<nsISHEntry> shentry = [...];
// LOG_SHENTRY_SPEC(("shentry %p has uri %s.", shentry.get(), _spec), shentry);
//
#define LOG_SHENTRY_SPEC(format, shentry) \
PR_BEGIN_MACRO \
- if (MOZ_LOG_TEST(GetSHistoryLog(), PR_LOG_DEBUG)) { \
+ if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) { \
nsCOMPtr<nsIURI> uri; \
shentry->GetURI(getter_AddRefs(uri)); \
LOG_SPEC(format, uri); \
} \
PR_END_MACRO
// Iterates over all registered session history listeners.
#define ITERATE_LISTENERS(body) \
--- a/dom/base/ThirdPartyUtil.cpp
+++ b/dom/base/ThirdPartyUtil.cpp
@@ -18,17 +18,17 @@
NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
//
// NSPR_LOG_MODULES=thirdPartyUtil:5
//
static PRLogModuleInfo *gThirdPartyLog;
#undef LOG
-#define LOG(args) MOZ_LOG(gThirdPartyLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gThirdPartyLog, mozilla::LogLevel::Debug, args)
nsresult
ThirdPartyUtil::Init()
{
NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_NOT_AVAILABLE);
nsresult rv;
mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
--- a/dom/base/nsContentPolicy.cpp
+++ b/dom/base/nsContentPolicy.cpp
@@ -183,32 +183,32 @@ nsContentPolicy::CheckPolicy(CPMethod
return NS_OK;
}
//uses the parameters from ShouldXYZ to produce and log a message
//logType must be a literal string constant
#define LOG_CHECK(logType) \
PR_BEGIN_MACRO \
/* skip all this nonsense if the call failed or logging is disabled */ \
- if (NS_SUCCEEDED(rv) && MOZ_LOG_TEST(gConPolLog, PR_LOG_DEBUG)) { \
+ if (NS_SUCCEEDED(rv) && MOZ_LOG_TEST(gConPolLog, LogLevel::Debug)) { \
const char *resultName; \
if (decision) { \
resultName = NS_CP_ResponseName(*decision); \
} else { \
resultName = "(null ptr)"; \
} \
nsAutoCString spec("None"); \
if (contentLocation) { \
contentLocation->GetSpec(spec); \
} \
nsAutoCString refSpec("None"); \
if (requestingLocation) { \
requestingLocation->GetSpec(refSpec); \
} \
- MOZ_LOG(gConPolLog, PR_LOG_DEBUG, \
+ MOZ_LOG(gConPolLog, LogLevel::Debug, \
("Content Policy: " logType ": <%s> <Ref:%s> result=%s", \
spec.get(), refSpec.get(), resultName) \
); \
} \
PR_END_MACRO
NS_IMETHODIMP
nsContentPolicy::ShouldLoad(uint32_t contentType,
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -6,17 +6,17 @@
#include "nsDOMDataChannel.h"
#include "base/basictypes.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetDataChannelLog();
#undef LOG
-#define LOG(args) MOZ_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(GetDataChannelLog(), mozilla::LogLevel::Debug, args)
#include "nsDOMDataChannelDeclarations.h"
#include "nsDOMDataChannel.h"
#include "nsIDOMDataChannel.h"
#include "nsIDOMMessageEvent.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/File.h"
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1590,17 +1590,17 @@ nsDocument::nsDocument(const char* aCont
, mViewportType(Unknown)
{
SetContentTypeInternal(nsDependentCString(aContentType));
if (!gDocumentLeakPRLog)
gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak");
if (gDocumentLeakPRLog)
- MOZ_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
("DOCUMENT %p created", this));
if (!gCspPRLog)
gCspPRLog = PR_NewLogModule("CSP");
// Start out mLastStyleSheetSet as null, per spec
SetDOMStringToNull(mLastStyleSheetSet);
@@ -1634,17 +1634,17 @@ nsIDocument::~nsIDocument()
UnlinkOriginalDocumentIfStatic();
}
nsDocument::~nsDocument()
{
if (gDocumentLeakPRLog)
- MOZ_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
("DOCUMENT %p destroyed", this));
NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document");
// Note: This assert is only non-fatal because mochitest-bc triggers
// it... as well as the preceding assert about !mIsShowing.
NS_ASSERTION(!mObservingAppThemeChanged,
"Document leaked to shutdown, then the observer service dropped "
@@ -2300,17 +2300,17 @@ nsDocument::Reset(nsIChannel* aChannel,
}
void
nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(aURI, "Null URI passed to ResetToURI");
- if (gDocumentLeakPRLog && MOZ_LOG_TEST(gDocumentLeakPRLog, PR_LOG_DEBUG)) {
+ if (gDocumentLeakPRLog && MOZ_LOG_TEST(gDocumentLeakPRLog, LogLevel::Debug)) {
nsAutoCString spec;
aURI->GetSpec(spec);
PR_LogPrint("DOCUMENT %p ResetToURI %s", this, spec.get());
}
mSecurityInfo = nullptr;
mDocumentLoadGroup = nullptr;
@@ -2633,17 +2633,17 @@ WarnIfSandboxIneffective(nsIDocShell* aD
nsresult
nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,
bool aReset, nsIContentSink* aSink)
{
- if (gDocumentLeakPRLog && MOZ_LOG_TEST(gDocumentLeakPRLog, PR_LOG_DEBUG)) {
+ if (gDocumentLeakPRLog && MOZ_LOG_TEST(gDocumentLeakPRLog, LogLevel::Debug)) {
nsCOMPtr<nsIURI> uri;
aChannel->GetURI(getter_AddRefs(uri));
nsAutoCString spec;
if (uri)
uri->GetSpec(spec);
PR_LogPrint("DOCUMENT %p StartDocumentLoad %s", this, spec.get());
}
@@ -2768,17 +2768,17 @@ AppendCSPFromHeader(nsIContentSecurityPo
// See RFC2616 section 4.2 (last paragraph)
nsresult rv = NS_OK;
nsCharSeparatedTokenizer tokenizer(aHeaderValue, ',');
while (tokenizer.hasMoreTokens()) {
const nsSubstring& policy = tokenizer.nextToken();
rv = csp->AppendPolicy(policy, aReportOnly);
NS_ENSURE_SUCCESS(rv, rv);
{
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gCspPRLog, LogLevel::Debug,
("CSP refined with policy: \"%s\"",
NS_ConvertUTF16toUTF8(policy).get()));
}
}
return NS_OK;
}
bool
@@ -2808,17 +2808,17 @@ nsDocument::IsLoopDocument(nsIChannel *a
return isLoop;
}
nsresult
nsDocument::InitCSP(nsIChannel* aChannel)
{
nsCOMPtr<nsIContentSecurityPolicy> csp;
if (!CSPService::sCSPEnabled) {
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gCspPRLog, LogLevel::Debug,
("CSP is disabled, skipping CSP init for document %p", this));
return NS_OK;
}
nsAutoCString tCspHeaderValue, tCspROHeaderValue;
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel) {
@@ -2861,31 +2861,31 @@ nsDocument::InitCSP(nsIChannel* aChannel
bool applyLoopCSP = IsLoopDocument(aChannel);
// If there's no CSP to apply, go ahead and return early
if (!applyAppDefaultCSP &&
!applyAppManifestCSP &&
!applyLoopCSP &&
cspHeaderValue.IsEmpty() &&
cspROHeaderValue.IsEmpty()) {
- if (MOZ_LOG_TEST(gCspPRLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gCspPRLog, LogLevel::Debug)) {
nsCOMPtr<nsIURI> chanURI;
aChannel->GetURI(getter_AddRefs(chanURI));
nsAutoCString aspec;
chanURI->GetAsciiSpec(aspec);
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gCspPRLog, LogLevel::Debug,
("no CSP for document, %s, %s",
aspec.get(),
applyAppDefaultCSP ? "is app" : "not an app"));
}
return NS_OK;
}
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("Document is an app or CSP header specified %p", this));
+ MOZ_LOG(gCspPRLog, LogLevel::Debug, ("Document is an app or CSP header specified %p", this));
nsresult rv;
// If Document is an app check to see if we already set CSP and return early
// if that is indeed the case.
//
// In general (see bug 947831), we should not be setting CSP on a principal
// that aliases another document. For non-app code this is not a problem
@@ -2894,28 +2894,28 @@ nsDocument::InitCSP(nsIChannel* aChannel
// about:srcodoc iframes) and thus won't try to set the CSP again. This
// check ensures that we do not try to set CSP for an app.
if (applyAppDefaultCSP || applyAppManifestCSP) {
nsCOMPtr<nsIContentSecurityPolicy> csp;
rv = principal->GetCsp(getter_AddRefs(csp));
NS_ENSURE_SUCCESS(rv, rv);
if (csp) {
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s",
+ MOZ_LOG(gCspPRLog, LogLevel::Debug, ("%s %s %s",
"This document is sharing principal with another document.",
"Since the document is an app, CSP was already set.",
"Skipping attempt to set CSP."));
return NS_OK;
}
}
csp = do_CreateInstance("@mozilla.org/cspcontext;1", &rv);
if (NS_FAILED(rv)) {
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("Failed to create CSP object: %x", rv));
+ MOZ_LOG(gCspPRLog, LogLevel::Debug, ("Failed to create CSP object: %x", rv));
return rv;
}
// used as a "self" identifier for the CSP.
nsCOMPtr<nsIURI> selfURI;
aChannel->GetURI(getter_AddRefs(selfURI));
// Store the request context for violation reports
@@ -2958,17 +2958,17 @@ nsDocument::InitCSP(nsIChannel* aChannel
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
if (docShell) {
bool safeAncestry = false;
// PermitsAncestry sends violation reports when necessary
rv = csp->PermitsAncestry(docShell, &safeAncestry);
if (NS_FAILED(rv) || !safeAncestry) {
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gCspPRLog, LogLevel::Debug,
("CSP doesn't like frame's ancestry, not loading."));
// stop! ERROR page!
aChannel->Cancel(NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION);
}
}
// ----- Set up any Referrer Policy specified by CSP
bool hasReferrerPolicy = false;
@@ -2983,17 +2983,17 @@ nsDocument::InitCSP(nsIChannel* aChannel
// Referrer Policy is set separately for the speculative parser in
// nsHTMLDocument::StartDocumentLoad() so there's nothing to do here for
// speculative loads.
}
rv = principal->SetCsp(csp);
NS_ENSURE_SUCCESS(rv, rv);
- MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gCspPRLog, LogLevel::Debug,
("Inserted CSP into principal %p", principal));
return NS_OK;
}
void
nsDocument::StopDocumentLoad()
{
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -72,26 +72,26 @@ using namespace mozilla::dom;
using namespace mozilla::widget;
// Two types of focus pr logging are available:
// 'Focus' for normal focus manager calls
// 'FocusNavigation' for tab and document navigation
PRLogModuleInfo* gFocusLog;
PRLogModuleInfo* gFocusNavigationLog;
-#define LOGFOCUS(args) MOZ_LOG(gFocusLog, PR_LOG_DEBUG, args)
-#define LOGFOCUSNAVIGATION(args) MOZ_LOG(gFocusNavigationLog, PR_LOG_DEBUG, args)
+#define LOGFOCUS(args) MOZ_LOG(gFocusLog, mozilla::LogLevel::Debug, args)
+#define LOGFOCUSNAVIGATION(args) MOZ_LOG(gFocusNavigationLog, mozilla::LogLevel::Debug, args)
#define LOGTAG(log, format, content) \
- if (MOZ_LOG_TEST(log, PR_LOG_DEBUG)) { \
+ if (MOZ_LOG_TEST(log, LogLevel::Debug)) { \
nsAutoCString tag(NS_LITERAL_CSTRING("(none)")); \
if (content) { \
content->NodeInfo()->NameAtom()->ToUTF8String(tag); \
} \
- MOZ_LOG(log, PR_LOG_DEBUG, (format, tag.get())); \
+ MOZ_LOG(log, LogLevel::Debug, (format, tag.get())); \
}
#define LOGCONTENT(format, content) LOGTAG(gFocusLog, format, content)
#define LOGCONTENTNAVIGATION(format, content) LOGTAG(gFocusNavigationLog, format, content)
struct nsDelayedBlurOrFocusEvent
{
nsDelayedBlurOrFocusEvent(uint32_t aType,
@@ -477,17 +477,17 @@ nsFocusManager::ElementIsFocusable(nsIDO
NS_IMETHODIMP
nsFocusManager::MoveFocus(nsIDOMWindow* aWindow, nsIDOMElement* aStartElement,
uint32_t aType, uint32_t aFlags, nsIDOMElement** aElement)
{
*aElement = nullptr;
LOGFOCUS(("<<MoveFocus begin Type: %d Flags: %x>>", aType, aFlags));
- if (MOZ_LOG_TEST(gFocusLog, PR_LOG_DEBUG) && mFocusedWindow) {
+ if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug) && mFocusedWindow) {
nsIDocument* doc = mFocusedWindow->GetExtantDoc();
if (doc && doc->GetDocumentURI()) {
nsAutoCString spec;
doc->GetDocumentURI()->GetSpec(spec);
LOGFOCUS((" Focused Window: %p %s", mFocusedWindow.get(), spec.get()));
}
}
@@ -633,17 +633,17 @@ nsFocusManager::MoveCaretToFocus(nsIDOMW
}
NS_IMETHODIMP
nsFocusManager::WindowRaised(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
NS_ENSURE_TRUE(window && window->IsOuterWindow(), NS_ERROR_INVALID_ARG);
- if (MOZ_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) {
LOGFOCUS(("Window %p Raised [Currently: %p %p]", aWindow, mActiveWindow.get(), mFocusedWindow.get()));
nsAutoCString spec;
nsIDocument* doc = window->GetExtantDoc();
if (doc && doc->GetDocumentURI()) {
doc->GetDocumentURI()->GetSpec(spec);
LOGFOCUS((" Raised Window: %p %s", aWindow, spec.get()));
}
if (mActiveWindow) {
@@ -729,17 +729,17 @@ nsFocusManager::WindowRaised(nsIDOMWindo
}
NS_IMETHODIMP
nsFocusManager::WindowLowered(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
NS_ENSURE_TRUE(window && window->IsOuterWindow(), NS_ERROR_INVALID_ARG);
- if (MOZ_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) {
LOGFOCUS(("Window %p Lowered [Currently: %p %p]", aWindow, mActiveWindow.get(), mFocusedWindow.get()));
nsAutoCString spec;
nsIDocument* doc = window->GetExtantDoc();
if (doc && doc->GetDocumentURI()) {
doc->GetDocumentURI()->GetSpec(spec);
LOGFOCUS((" Lowered Window: %s", spec.get()));
}
if (mActiveWindow) {
@@ -847,17 +847,17 @@ nsFocusManager::ContentRemoved(nsIDocume
NS_IMETHODIMP
nsFocusManager::WindowShown(nsIDOMWindow* aWindow, bool aNeedsFocus)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
window = window->GetOuterWindow();
- if (MOZ_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) {
LOGFOCUS(("Window %p Shown [Currently: %p %p]", window.get(), mActiveWindow.get(), mFocusedWindow.get()));
nsAutoCString spec;
nsIDocument* doc = window->GetExtantDoc();
if (doc && doc->GetDocumentURI()) {
doc->GetDocumentURI()->GetSpec(spec);
LOGFOCUS(("Shown Window: %s", spec.get()));
}
@@ -902,17 +902,17 @@ nsFocusManager::WindowHidden(nsIDOMWindo
// currently focused window, just return, as the current focus will not
// be affected.
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
window = window->GetOuterWindow();
- if (MOZ_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) {
LOGFOCUS(("Window %p Hidden [Currently: %p %p]", window.get(), mActiveWindow.get(), mFocusedWindow.get()));
nsAutoCString spec;
nsIDocument* doc = window->GetExtantDoc();
if (doc && doc->GetDocumentURI()) {
doc->GetDocumentURI()->GetSpec(spec);
LOGFOCUS((" Hide Window: %s", spec.get()));
}
@@ -1772,17 +1772,17 @@ nsFocusManager::Focus(nsPIDOMWindow* aWi
bool clearFirstFocusEvent = false;
if (!mFirstFocusEvent) {
mFirstFocusEvent = aContent;
clearFirstFocusEvent = true;
}
LOGCONTENT("Element %s has been focused", aContent);
- if (MOZ_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) {
nsIDocument* docm = aWindow->GetExtantDoc();
if (docm) {
LOGCONTENT(" from %s", docm->GetRootElement());
}
LOGFOCUS((" [Newdoc: %d FocusChanged: %d Raised: %d Flags: %x]",
aIsNewDocument, aFocusChanged, aWindowRaised, aFlags));
}
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1206,17 +1206,17 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalW
static_cast<void*>(ToCanonicalSupports(this)),
getpid(),
gSerialCounter,
static_cast<void*>(ToCanonicalSupports(aOuterWindow)));
}
#endif
if (gDOMLeakPRLog)
- MOZ_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
("DOMWINDOW %p created outer=%p", this, aOuterWindow));
NS_ASSERTION(sWindowsById, "Windows hash table must be created!");
NS_ASSERTION(!sWindowsById->Get(mWindowID),
"This window shouldn't be in the hash table yet!");
// We seem to see crashes in release builds because of null |sWindowsById|.
if (sWindowsById) {
sWindowsById->Put(mWindowID, this);
@@ -1296,17 +1296,17 @@ nsGlobalWindow::~nsGlobalWindow()
getpid(),
mSerial,
static_cast<void*>(ToCanonicalSupports(outer)),
url.get());
}
#endif
if (gDOMLeakPRLog)
- MOZ_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
("DOMWINDOW %p destroyed", this));
if (IsOuterWindow()) {
JSObject *proxy = GetWrapperPreserveColor();
if (proxy) {
js::SetProxyExtra(proxy, 0, js::PrivateValue(nullptr));
}
@@ -2799,17 +2799,17 @@ nsGlobalWindow::ClearStatus()
}
void
nsGlobalWindow::InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument)
{
NS_PRECONDITION(IsInnerWindow(), "Must only be called on inner windows");
MOZ_ASSERT(aDocument);
- if (gDOMLeakPRLog && MOZ_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
+ if (gDOMLeakPRLog && MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) {
nsIURI *uri = aDocument->GetDocumentURI();
nsAutoCString spec;
if (uri)
uri->GetSpec(spec);
PR_LogPrint("DOMWINDOW %p SetNewDocument %s", this, spec.get());
}
mDoc = aDocument;
@@ -10553,17 +10553,17 @@ nsGlobalWindow::GetSessionStorage(ErrorR
nsIPrincipal *principal = GetPrincipal();
nsIDocShell* docShell = GetDocShell();
if (!principal || !docShell || !Preferences::GetBool(kStorageEnabled)) {
return nullptr;
}
if (mSessionStorage) {
- if (MOZ_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) {
PR_LogPrint("nsGlobalWindow %p has %p sessionStorage", this, mSessionStorage.get());
}
bool canAccess = mSessionStorage->CanAccess(principal);
NS_ASSERTION(canAccess,
"This window owned sessionStorage "
"that could not be accessed!");
if (!canAccess) {
mSessionStorage = nullptr;
@@ -10604,27 +10604,27 @@ nsGlobalWindow::GetSessionStorage(ErrorR
getter_AddRefs(storage));
if (aError.Failed()) {
return nullptr;
}
mSessionStorage = static_cast<DOMStorage*>(storage.get());
MOZ_ASSERT(mSessionStorage);
- if (MOZ_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) {
PR_LogPrint("nsGlobalWindow %p tried to get a new sessionStorage %p", this, mSessionStorage.get());
}
if (!mSessionStorage) {
aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
}
- if (MOZ_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) {
PR_LogPrint("nsGlobalWindow %p returns %p sessionStorage", this, mSessionStorage.get());
}
return mSessionStorage;
}
NS_IMETHODIMP
nsGlobalWindow::GetSessionStorage(nsISupports** aSessionStorage)
@@ -11532,17 +11532,17 @@ nsGlobalWindow::Observe(nsISupports* aSu
}
if (!check) {
// This storage event is not coming from our storage or is coming
// from a different docshell, i.e. it is a clone, ignore this event.
return NS_OK;
}
- if (MOZ_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) {
PR_LogPrint("nsGlobalWindow %p with sessionStorage %p passing event from %p",
this, mSessionStorage.get(), changingStorage.get());
}
fireMozStorageChanged = mSessionStorage == changingStorage;
break;
}
--- a/dom/base/nsNodeInfoManager.cpp
+++ b/dom/base/nsNodeInfoManager.cpp
@@ -114,17 +114,17 @@ nsNodeInfoManager::nsNodeInfoManager()
mDocumentNodeInfo(nullptr)
{
nsLayoutStatics::AddRef();
if (!gNodeInfoManagerLeakPRLog)
gNodeInfoManagerLeakPRLog = PR_NewLogModule("NodeInfoManagerLeak");
if (gNodeInfoManagerLeakPRLog)
- MOZ_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug,
("NODEINFOMANAGER %p created", this));
mNodeInfoHash = PL_NewHashTable(32, GetNodeInfoInnerHashValue,
NodeInfoInnerKeyCompare,
PL_CompareValues, &allocOps, nullptr);
}
@@ -134,17 +134,17 @@ nsNodeInfoManager::~nsNodeInfoManager()
PL_HashTableDestroy(mNodeInfoHash);
// Note: mPrincipal may be null here if we never got inited correctly
mPrincipal = nullptr;
mBindingManager = nullptr;
if (gNodeInfoManagerLeakPRLog)
- MOZ_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug,
("NODEINFOMANAGER %p destroyed", this));
nsLayoutStatics::Release();
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsNodeInfoManager)
@@ -191,17 +191,17 @@ nsNodeInfoManager::Init(nsIDocument *aDo
mBindingManager = new nsBindingManager(aDocument);
}
mDefaultPrincipal = mPrincipal;
mDocument = aDocument;
if (gNodeInfoManagerLeakPRLog)
- MOZ_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
+ MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug,
("NODEINFOMANAGER %p Init document=%p", this, aDocument));
return NS_OK;
}
// static
int
nsNodeInfoManager::DropNodeInfoDocument(PLHashEntry *he, int hashIndex, void *arg)
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -111,18 +111,18 @@ static PRLogModuleInfo*
GetObjectLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("objlc");
return sLog;
}
-#define LOG(args) MOZ_LOG(GetObjectLog(), PR_LOG_DEBUG, args)
-#define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), PR_LOG_DEBUG)
+#define LOG(args) MOZ_LOG(GetObjectLog(), mozilla::LogLevel::Debug, args)
+#define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), mozilla::LogLevel::Debug)
static bool
IsJavaMIME(const nsACString & aMIMEType)
{
return
nsPluginHost::GetSpecialType(aMIMEType) == nsPluginHost::eSpecialType_Java;
}
--- a/dom/camera/CameraCommon.h
+++ b/dom/camera/CameraCommon.h
@@ -13,17 +13,17 @@
#else
#define __func__ __FILE__
#endif
#endif
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetCameraLog();
-#define DOM_CAMERA_LOG( type, ... ) MOZ_LOG(GetCameraLog(), (PRLogModuleLevel)type, ( __VA_ARGS__ ))
+#define DOM_CAMERA_LOG( type, ... ) MOZ_LOG(GetCameraLog(), (mozilla::LogLevel)type, ( __VA_ARGS__ ))
#define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( 0, __VA_ARGS__ )
/**
* From the least to the most output.
*/
enum {
DOM_CAMERA_LOG_NOTHING,
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -38,26 +38,26 @@
namespace mozilla {
using namespace dom;
using namespace widget;
/**
* When a method is called, log its arguments and/or related static variables
- * with PR_LOG_INFO. However, if it puts too many logs like
+ * with LogLevel::Info. However, if it puts too many logs like
* OnDestroyPresContext(), should long only when the method actually does
* something. In this case, the log should start with "ISM: <method name>".
*
* When a method quits due to unexpected situation, log the reason with
- * PR_LOG_ERROR. In this case, the log should start with
+ * LogLevel::Error. In this case, the log should start with
* "ISM: <method name>(), FAILED". The indent makes the log look easier.
*
* When a method does something only in some situations and it may be important
- * for debug, log the information with PR_LOG_DEBUG. In this case, the log
+ * for debug, log the information with LogLevel::Debug. In this case, the log
* should start with "ISM: <method name>(),".
*/
PRLogModuleInfo* sISMLog = nullptr;
static const char*
GetBoolName(bool aBool)
{
return aBool ? "true" : "false";
@@ -195,17 +195,17 @@ IMEStateManager::Init()
sISMLog = PR_NewLogModule("IMEStateManager");
}
}
// static
void
IMEStateManager::Shutdown()
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::Shutdown(), "
"sTextCompositions=0x%p, sTextCompositions->Length()=%u",
sTextCompositions, sTextCompositions ? sTextCompositions->Length() : 0));
MOZ_ASSERT(!sTextCompositions || !sTextCompositions->Length());
delete sTextCompositions;
sTextCompositions = nullptr;
}
@@ -216,37 +216,37 @@ IMEStateManager::OnDestroyPresContext(ns
{
NS_ENSURE_ARG_POINTER(aPresContext);
// First, if there is a composition in the aPresContext, clean up it.
if (sTextCompositions) {
TextCompositionArray::index_type i =
sTextCompositions->IndexOf(aPresContext);
if (i != TextCompositionArray::NoIndex) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnDestroyPresContext(), "
"removing TextComposition instance from the array (index=%u)", i));
// there should be only one composition per presContext object.
sTextCompositions->ElementAt(i)->Destroy();
sTextCompositions->RemoveElementAt(i);
if (sTextCompositions->IndexOf(aPresContext) !=
TextCompositionArray::NoIndex) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::OnDestroyPresContext(), FAILED to remove "
"TextComposition instance from the array"));
MOZ_CRASH("Failed to remove TextComposition instance from the array");
}
}
}
if (aPresContext != sPresContext) {
return NS_OK;
}
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnDestroyPresContext(aPresContext=0x%p), "
"sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p",
aPresContext, sPresContext, sContent, sTextCompositions));
DestroyIMEContentObserver();
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
if (widget) {
@@ -268,17 +268,17 @@ IMEStateManager::OnRemoveContent(nsPresC
NS_ENSURE_ARG_POINTER(aPresContext);
// First, if there is a composition in the aContent, clean up it.
if (sTextCompositions) {
nsRefPtr<TextComposition> compositionInContent =
sTextCompositions->GetCompositionInContent(aPresContext, aContent);
if (compositionInContent) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnRemoveContent(), "
"composition is in the content"));
// Try resetting the native IME state. Be aware, typically, this method
// is called during the content being removed. Then, the native
// composition events which are caused by following APIs are ignored due
// to unsafe to run script (in PresShell::HandleEvent()).
nsCOMPtr<nsIWidget> widget = aPresContext->GetRootWidget();
@@ -291,17 +291,17 @@ IMEStateManager::OnRemoveContent(nsPresC
}
}
if (!sPresContext || !sContent ||
!nsContentUtils::ContentIsDescendantOf(sContent, aContent)) {
return NS_OK;
}
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnRemoveContent(aPresContext=0x%p, "
"aContent=0x%p), sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p",
aPresContext, aContent, sPresContext, sContent, sTextCompositions));
DestroyIMEContentObserver();
// Current IME transaction should commit
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
@@ -319,32 +319,32 @@ IMEStateManager::OnRemoveContent(nsPresC
}
// static
nsresult
IMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction::Cause aCause)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnChangeFocus(aPresContext=0x%p, "
"aContent=0x%p, aCause=%s)",
aPresContext, aContent, GetActionCauseName(aCause)));
InputContextAction action(aCause);
return OnChangeFocusInternal(aPresContext, aContent, action);
}
// static
nsresult
IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction aAction)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnChangeFocusInternal(aPresContext=0x%p, "
"aContent=0x%p, aAction={ mCause=%s, mFocusChange=%s }), "
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p",
aPresContext, aContent, GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange),
sPresContext, sContent, sActiveIMEContentObserver));
bool focusActuallyChanging =
@@ -362,27 +362,27 @@ IMEStateManager::OnChangeFocusInternal(n
if (sActiveIMEContentObserver &&
(aPresContext || !sActiveIMEContentObserver->KeepAliveDuringDeactive()) &&
!sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
DestroyIMEContentObserver();
}
if (!aPresContext) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnChangeFocusInternal(), "
"no nsPresContext is being activated"));
return NS_OK;
}
nsCOMPtr<nsIWidget> widget =
(sPresContext == aPresContext) ? oldWidget.get() :
aPresContext->GetRootWidget();
if (NS_WARN_IF(!widget)) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::OnChangeFocusInternal(), FAILED due to "
"no widget to manage its IME state"));
return NS_OK;
}
IMEState newState = GetNewIMEState(aPresContext, aContent);
// In e10s, remote content may have IME focus. The main process (i.e. this process)
@@ -390,32 +390,32 @@ IMEStateManager::OnChangeFocusInternal(n
// some other remote content. The content process would later re-ENABLE IME, meaning
// that all state-changes were unnecessary.
// Here we filter the common case where the main process knows that the remote
// process controls IME focus. The DISABLED->re-ENABLED progression can
// still happen since remote content may be concurrently communicating its claim
// on focus to the main process... but this cannot cause bugs like missed keypresses.
// (It just means a lot of needless IPC.)
if ((newState.mEnabled == IMEState::DISABLED) && TabParent::GetIMETabParent()) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnChangeFocusInternal(), "
"Parent process cancels to set DISABLED state because the content process "
"has IME focus and has already sets IME state"));
MOZ_ASSERT(XRE_IsParentProcess(),
"TabParent::GetIMETabParent() should never return non-null value "
"in the content process");
return NS_OK;
}
if (!focusActuallyChanging) {
// actual focus isn't changing, but if IME enabled state is changing,
// we should do it.
InputContext context = widget->GetInputContext();
if (context.mIMEState.mEnabled == newState.mEnabled) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnChangeFocusInternal(), "
"neither focus nor IME state is changing"));
return NS_OK;
}
aAction.mFocusChange = InputContextAction::FOCUS_NOT_CHANGED;
// Even if focus isn't changing actually, we should commit current
// composition here since the IME state is changing.
@@ -444,17 +444,17 @@ IMEStateManager::OnChangeFocusInternal(n
return NS_OK;
}
// static
void
IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnInstalledMenuKeyboardListener(aInstalling=%s), "
"sInstalledMenuKeyboardListener=%s",
GetBoolName(aInstalling), GetBoolName(sInstalledMenuKeyboardListener)));
sInstalledMenuKeyboardListener = aInstalling;
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
aInstalling ? InputContextAction::MENU_GOT_PSEUDO_FOCUS :
@@ -463,113 +463,113 @@ IMEStateManager::OnInstalledMenuKeyboard
}
// static
bool
IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(aPresContext=0x%p, "
"aContent=0x%p, aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p",
aPresContext, aContent, aMouseEvent, sPresContext, sContent));
if (sPresContext != aPresContext || sContent != aContent) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
"the mouse event isn't fired on the editor managed by ISM"));
return false;
}
if (!sActiveIMEContentObserver) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
"there is no active IMEContentObserver"));
return false;
}
if (!sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
"the active IMEContentObserver isn't managing the editor"));
return false;
}
WidgetMouseEvent* internalEvent =
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
if (NS_WARN_IF(!internalEvent)) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
"the internal event of aMouseEvent isn't WidgetMouseEvent"));
return false;
}
bool consumed =
sActiveIMEContentObserver->OnMouseButtonEvent(aPresContext, internalEvent);
- if (MOZ_LOG_TEST(sISMLog, PR_LOG_INFO)) {
+ if (MOZ_LOG_TEST(sISMLog, LogLevel::Info)) {
nsAutoString eventType;
aMouseEvent->GetType(eventType);
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
"mouse event (type=%s, button=%d) is %s",
NS_ConvertUTF16toUTF8(eventType).get(), internalEvent->button,
consumed ? "consumed" : "not consumed"));
}
return consumed;
}
// static
void
IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnClickInEditor(aPresContext=0x%p, aContent=0x%p, "
"aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p",
aPresContext, aContent, aMouseEvent, sPresContext, sContent));
if (sPresContext != aPresContext || sContent != aContent) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnClickInEditor(), "
"the mouse event isn't fired on the editor managed by ISM"));
return;
}
nsCOMPtr<nsIWidget> widget = aPresContext->GetRootWidget();
NS_ENSURE_TRUE_VOID(widget);
bool isTrusted;
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
NS_ENSURE_SUCCESS_VOID(rv);
if (!isTrusted) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnClickInEditor(), "
"the mouse event isn't a trusted event"));
return; // ignore untrusted event.
}
int16_t button;
rv = aMouseEvent->GetButton(&button);
NS_ENSURE_SUCCESS_VOID(rv);
if (button != 0) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnClickInEditor(), "
"the mouse event isn't a left mouse button event"));
return; // not a left click event.
}
int32_t clickCount;
rv = aMouseEvent->GetDetail(&clickCount);
NS_ENSURE_SUCCESS_VOID(rv);
if (clickCount != 1) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnClickInEditor(), "
"the mouse event isn't a single click event"));
return; // should notify only first click event.
}
InputContextAction action(InputContextAction::CAUSE_MOUSE,
InputContextAction::FOCUS_NOT_CHANGED);
IMEState newState = GetNewIMEState(aPresContext, aContent);
@@ -577,92 +577,92 @@ IMEStateManager::OnClickInEditor(nsPresC
}
// static
void
IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIEditor* aEditor)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnFocusInEditor(aPresContext=0x%p, aContent=0x%p, "
"aEditor=0x%p), sPresContext=0x%p, sContent=0x%p, "
"sActiveIMEContentObserver=0x%p",
aPresContext, aContent, aEditor, sPresContext, sContent,
sActiveIMEContentObserver));
if (sPresContext != aPresContext || sContent != aContent) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnFocusInEditor(), "
"an editor not managed by ISM gets focus"));
return;
}
// If the IMEContentObserver instance isn't managing the editor actually,
// we need to recreate the instance.
if (sActiveIMEContentObserver) {
if (sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::OnFocusInEditor(), "
"the editor is already being managed by sActiveIMEContentObserver"));
return;
}
DestroyIMEContentObserver();
}
CreateIMEContentObserver(aEditor);
}
// static
void
IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
nsIContent* aContent,
nsIEditor* aEditor)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::UpdateIMEState(aNewIMEState={ mEnabled=%s, "
"mOpen=%s }, aContent=0x%p, aEditor=0x%p), "
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, "
"sIsGettingNewIMEState=%s",
GetIMEStateEnabledName(aNewIMEState.mEnabled),
GetIMEStateSetOpenName(aNewIMEState.mOpen), aContent, aEditor,
sPresContext, sContent, sActiveIMEContentObserver,
GetBoolName(sIsGettingNewIMEState)));
if (sIsGettingNewIMEState) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::UpdateIMEState(), "
"does nothing because of called while getting new IME state"));
return;
}
if (NS_WARN_IF(!sPresContext)) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::UpdateIMEState(), FAILED due to "
"no managing nsPresContext"));
return;
}
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
if (NS_WARN_IF(!widget)) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::UpdateIMEState(), FAILED due to "
"no widget for the managing nsPresContext"));
return;
}
// Even if there is active IMEContentObserver, it may not be observing the
// editor with current editable root content due to reframed. In such case,
// We should try to reinitialize the IMEContentObserver.
if (sActiveIMEContentObserver && IsIMEObserverNeeded(aNewIMEState)) {
- PR_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::UpdateIMEState(), try to reinitialize the "
"active IMEContentObserver"));
if (!sActiveIMEContentObserver->MaybeReinitialize(widget, sPresContext,
aContent, aEditor)) {
- PR_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::UpdateIMEState(), failed to reinitialize the "
"active IMEContentObserver"));
}
}
// If there is no active IMEContentObserver or it isn't observing the
// editor correctly, we should recreate it.
bool createTextStateManager =
@@ -692,62 +692,62 @@ IMEStateManager::UpdateIMEState(const IM
}
}
// static
IMEState
IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
nsIContent* aContent)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::GetNewIMEState(aPresContext=0x%p, aContent=0x%p), "
"sInstalledMenuKeyboardListener=%s",
aPresContext, aContent, GetBoolName(sInstalledMenuKeyboardListener)));
// On Printing or Print Preview, we don't need IME.
if (aPresContext->Type() == nsPresContext::eContext_PrintPreview ||
aPresContext->Type() == nsPresContext::eContext_Print) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
"the nsPresContext is for print or print preview"));
return IMEState(IMEState::DISABLED);
}
if (sInstalledMenuKeyboardListener) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
"menu keyboard listener was installed"));
return IMEState(IMEState::DISABLED);
}
if (!aContent) {
// Even if there are no focused content, the focused document might be
// editable, such case is design mode.
nsIDocument* doc = aPresContext->Document();
if (doc && doc->HasFlag(NODE_IS_EDITABLE)) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::GetNewIMEState() returns ENABLED because "
"design mode editor has focus"));
return IMEState(IMEState::ENABLED);
}
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
"no content has focus"));
return IMEState(IMEState::DISABLED);
}
// nsIContent::GetDesiredIMEState() may cause a call of UpdateIMEState()
// from nsEditor::PostCreate() because GetDesiredIMEState() needs to retrieve
// an editor instance for the element if it's editable element.
// For avoiding such nested IME state updates, we should set
// sIsGettingNewIMEState here and UpdateIMEState() should check it.
GettingNewIMEStateBlocker blocker;
IMEState newIMEState = aContent->GetDesiredIMEState();
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::GetNewIMEState() returns { mEnabled=%s, "
"mOpen=%s }",
GetIMEStateEnabledName(newIMEState.mEnabled),
GetIMEStateSetOpenName(newIMEState.mOpen)));
return newIMEState;
}
// Helper class, used for IME enabled state change notification
@@ -758,17 +758,17 @@ public:
{
}
NS_IMETHOD Run()
{
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (observerService) {
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEEnabledStateChangedEvent::Run(), notifies observers of "
"\"ime-enabled-state-changed\""));
nsAutoString state;
state.AppendInt(mState);
observerService->NotifyObservers(nullptr, "ime-enabled-state-changed",
state.get());
}
return NS_OK;
@@ -780,17 +780,17 @@ private:
// static
void
IMEStateManager::SetIMEState(const IMEState& aState,
nsIContent* aContent,
nsIWidget* aWidget,
InputContextAction aAction)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::SetIMEState(aState={ mEnabled=%s, mOpen=%s }, "
"aContent=0x%p, aWidget=0x%p, aAction={ mCause=%s, mFocusChange=%s })",
GetIMEStateEnabledName(aState.mEnabled),
GetIMEStateSetOpenName(aState.mOpen), aContent, aWidget,
GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange)));
NS_ENSURE_TRUE_VOID(aWidget);
@@ -866,17 +866,17 @@ IMEStateManager::SetIMEState(const IMESt
// XXX I think that we should use nsContentUtils::IsCallerChrome() instead
// of the process type.
if (aAction.mCause == InputContextAction::CAUSE_UNKNOWN &&
XRE_GetProcessType() != GeckoProcessType_Content) {
aAction.mCause = InputContextAction::CAUSE_UNKNOWN_CHROME;
}
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::SetIMEState(), "
"calling nsIWidget::SetInputContext(context={ mIMEState={ mEnabled=%s, "
"mOpen=%s }, mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", "
"mActionHint=\"%s\" }, aAction={ mCause=%s, mAction=%s })",
GetIMEStateEnabledName(context.mIMEState.mEnabled),
GetIMEStateSetOpenName(context.mIMEState.mOpen),
NS_ConvertUTF16toUTF8(context.mHTMLInputType).get(),
NS_ConvertUTF16toUTF8(context.mHTMLInputInputmode).get(),
@@ -908,17 +908,17 @@ void
IMEStateManager::DispatchCompositionEvent(
nsINode* aEventTargetNode,
nsPresContext* aPresContext,
WidgetCompositionEvent* aCompositionEvent,
nsEventStatus* aStatus,
EventDispatchingCallback* aCallBack,
bool aIsSynthesized)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::DispatchCompositionEvent(aNode=0x%p, "
"aPresContext=0x%p, aCompositionEvent={ message=%s, "
"mFlags={ mIsTrusted=%s, mPropagationStopped=%s } }, "
"aIsSynthesized=%s)",
aEventTargetNode, aPresContext,
GetEventMessageName(aCompositionEvent->message),
GetBoolName(aCompositionEvent->mFlags.mIsTrusted),
GetBoolName(aCompositionEvent->mFlags.mPropagationStopped),
@@ -937,17 +937,17 @@ IMEStateManager::DispatchCompositionEven
nsRefPtr<TextComposition> composition =
sTextCompositions->GetCompositionFor(aCompositionEvent->widget);
if (!composition) {
// If synthesized event comes after delayed native composition events
// for request of commit or cancel, we should ignore it.
if (NS_WARN_IF(aIsSynthesized)) {
return;
}
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::DispatchCompositionEvent(), "
"adding new TextComposition to the array"));
MOZ_ASSERT(aCompositionEvent->message == NS_COMPOSITION_START);
composition =
new TextComposition(aPresContext, aEventTargetNode, aCompositionEvent);
sTextCompositions->AppendElement(composition);
}
#ifdef DEBUG
@@ -973,17 +973,17 @@ IMEStateManager::DispatchCompositionEven
// the last event for the composition. In this case, we need to
// destroy the TextComposition with synthesized compositionend event.
if ((!aIsSynthesized ||
composition->WasNativeCompositionEndEventDiscarded()) &&
aCompositionEvent->CausesDOMCompositionEndEvent()) {
TextCompositionArray::index_type i =
sTextCompositions->IndexOf(aCompositionEvent->widget);
if (i != TextCompositionArray::NoIndex) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::DispatchCompositionEvent(), "
"removing TextComposition from the array since NS_COMPOSTION_END "
"was dispatched"));
sTextCompositions->ElementAt(i)->Destroy();
sTextCompositions->RemoveElementAt(i);
}
}
}
@@ -991,17 +991,17 @@ IMEStateManager::DispatchCompositionEven
// static
void
IMEStateManager::OnCompositionEventDiscarded(
const WidgetCompositionEvent* aCompositionEvent)
{
// Note that this method is never called for synthesized events for emulating
// commit or cancel composition.
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnCompositionEventDiscarded(aCompositionEvent={ "
"message=%s, mFlags={ mIsTrusted=%s } })",
GetEventMessageName(aCompositionEvent->message),
GetBoolName(aCompositionEvent->mFlags.mIsTrusted)));
if (!aCompositionEvent->mFlags.mIsTrusted) {
return;
}
@@ -1014,17 +1014,17 @@ IMEStateManager::OnCompositionEventDisca
nsRefPtr<TextComposition> composition =
sTextCompositions->GetCompositionFor(aCompositionEvent->widget);
if (!composition) {
// If the PresShell has been being destroyed during composition,
// a TextComposition instance for the composition was already removed from
// the array and destroyed in OnDestroyPresContext(). Therefore, we may
// fail to retrieve a TextComposition instance here.
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnCompositionEventDiscarded(), "
"TextComposition instance for the widget has already gone"));
return;
}
composition->OnCompositionEventDiscarded(aCompositionEvent);
}
// static
@@ -1035,24 +1035,24 @@ IMEStateManager::NotifyIME(IMEMessage aM
nsRefPtr<TextComposition> composition;
if (aWidget && sTextCompositions) {
composition = sTextCompositions->GetCompositionFor(aWidget);
}
bool isSynthesizedForTests =
composition && composition->IsSynthesizedForTests();
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aWidget=0x%p), "
"composition=0x%p, composition->IsSynthesizedForTests()=%s",
GetNotifyIMEMessageName(aMessage), aWidget, composition.get(),
GetBoolName(isSynthesizedForTests)));
if (NS_WARN_IF(!aWidget)) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget"));
return NS_ERROR_INVALID_ARG;
}
switch (aMessage) {
case REQUEST_TO_COMMIT_COMPOSITION:
return composition ?
composition->RequestToCommit(aWidget, false) : NS_OK;
@@ -1070,25 +1070,25 @@ IMEStateManager::NotifyIME(IMEMessage aM
return NS_ERROR_FAILURE;
}
// static
nsresult
IMEStateManager::NotifyIME(IMEMessage aMessage,
nsPresContext* aPresContext)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aPresContext=0x%p)",
GetNotifyIMEMessageName(aMessage), aPresContext));
NS_ENSURE_TRUE(aPresContext, NS_ERROR_INVALID_ARG);
nsIWidget* widget = aPresContext->GetRootWidget();
if (NS_WARN_IF(!widget)) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget for the "
"nsPresContext"));
return NS_ERROR_NOT_AVAILABLE;
}
return NotifyIME(aMessage, widget);
}
// static
@@ -1145,72 +1145,72 @@ IMEStateManager::IsIMEObserverNeeded(con
{
return aState.IsEditable();
}
// static
void
IMEStateManager::DestroyIMEContentObserver()
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::DestroyIMEContentObserver(), "
"sActiveIMEContentObserver=0x%p",
sActiveIMEContentObserver));
if (!sActiveIMEContentObserver) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::DestroyIMEContentObserver() does nothing"));
return;
}
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::DestroyIMEContentObserver(), destroying "
"the active IMEContentObserver..."));
nsRefPtr<IMEContentObserver> tsm;
tsm.swap(sActiveIMEContentObserver);
tsm->Destroy();
}
// static
void
IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor)
{
- MOZ_LOG(sISMLog, PR_LOG_INFO,
+ MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::CreateIMEContentObserver(aEditor=0x%p), "
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, "
"sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=%s",
aEditor, sPresContext, sContent, sActiveIMEContentObserver,
GetBoolName(sActiveIMEContentObserver ?
sActiveIMEContentObserver->IsManaging(sPresContext, sContent) : false)));
if (NS_WARN_IF(sActiveIMEContentObserver)) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to "
"there is already an active IMEContentObserver"));
MOZ_ASSERT(sActiveIMEContentObserver->IsManaging(sPresContext, sContent));
return;
}
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
if (!widget) {
- MOZ_LOG(sISMLog, PR_LOG_ERROR,
+ MOZ_LOG(sISMLog, LogLevel::Error,
("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to "
"there is a root widget for the nsPresContext"));
return; // Sometimes, there are no widgets.
}
// If it's not text editable, we don't need to create IMEContentObserver.
if (!IsIMEObserverNeeded(widget->GetInputContext().mIMEState)) {
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::CreateIMEContentObserver() doesn't create "
"IMEContentObserver because of non-editable IME state"));
return;
}
- MOZ_LOG(sISMLog, PR_LOG_DEBUG,
+ MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::CreateIMEContentObserver() is creating an "
"IMEContentObserver instance..."));
sActiveIMEContentObserver = new IMEContentObserver();
NS_ADDREF(sActiveIMEContentObserver);
// IMEContentObserver::Init() might create another IMEContentObserver
// instance. So, sActiveIMEContentObserver would be replaced with new one.
// We should hold the current instance here.
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -233,17 +233,17 @@ public:
mSource(aSource)
{
}
NS_IMETHOD Run() {
// Silently cancel if our load has been cancelled.
if (IsCancelled())
return NS_OK;
- LOG_EVENT(PR_LOG_DEBUG, ("%p Dispatching simple event source error", mElement.get()));
+ LOG_EVENT(LogLevel::Debug, ("%p Dispatching simple event source error", mElement.get()));
return nsContentUtils::DispatchTrustedEvent(mElement->OwnerDoc(),
mSource,
NS_LITERAL_STRING("error"),
false,
false);
}
};
@@ -862,17 +862,17 @@ void HTMLMediaElement::SelectResource()
// If we have a 'src' attribute, use that exclusively.
nsAutoString src;
if (mSrcAttrStream) {
SetupSrcMediaStreamPlayback(mSrcAttrStream);
} else if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
nsCOMPtr<nsIURI> uri;
nsresult rv = NewURIFromString(src, getter_AddRefs(uri));
if (NS_SUCCEEDED(rv)) {
- LOG(PR_LOG_DEBUG, ("%p Trying load from src=%s", this, NS_ConvertUTF16toUTF8(src).get()));
+ LOG(LogLevel::Debug, ("%p Trying load from src=%s", this, NS_ConvertUTF16toUTF8(src).get()));
NS_ASSERTION(!mIsLoadingFromSourceChildren,
"Should think we're not loading from source children by default");
mLoadingSrc = uri;
UpdatePreloadAction();
if (mPreloadAction == HTMLMediaElement::PRELOAD_NONE &&
!IsMediaStreamURI(mLoadingSrc)) {
// preload:none media, suspend the load here before we make any
@@ -895,17 +895,17 @@ void HTMLMediaElement::SelectResource()
mIsLoadingFromSourceChildren = true;
LoadFromSourceChildren();
}
}
void HTMLMediaElement::NotifyLoadError()
{
if (!mIsLoadingFromSourceChildren) {
- LOG(PR_LOG_DEBUG, ("NotifyLoadError(), no supported media error"));
+ LOG(LogLevel::Debug, ("NotifyLoadError(), no supported media error"));
NoSupportedMediaSourceError();
} else if (mSourceLoadCandidate) {
DispatchAsyncSourceError(mSourceLoadCandidate);
QueueLoadFromSourceTask();
} else {
NS_WARNING("Should know the source we were loading from!");
}
}
@@ -990,17 +990,17 @@ void HTMLMediaElement::LoadFromSourceChi
HTMLSourceElement *childSrc = HTMLSourceElement::FromContent(child);
MOZ_ASSERT(childSrc, "Expect child to be HTMLSourceElement");
if (childSrc && !childSrc->MatchesCurrentMedia()) {
DispatchAsyncSourceError(child);
const char16_t* params[] = { media.get(), src.get() };
ReportLoadError("MediaLoadSourceMediaNotMatched", params, ArrayLength(params));
continue;
}
- LOG(PR_LOG_DEBUG, ("%p Trying load from <source>=%s type=%s media=%s", this,
+ LOG(LogLevel::Debug, ("%p Trying load from <source>=%s type=%s media=%s", this,
NS_ConvertUTF16toUTF8(src).get(), NS_ConvertUTF16toUTF8(type).get(),
NS_ConvertUTF16toUTF8(media).get()));
nsCOMPtr<nsIURI> uri;
NewURIFromString(src, getter_AddRefs(uri));
if (!uri) {
DispatchAsyncSourceError(child);
const char16_t* params[] = { src.get() };
@@ -1448,41 +1448,41 @@ HTMLMediaElement::Seek(double aTime,
if (mSrcStream) {
// do nothing since streams aren't seekable; we effectively clamp to
// the current time.
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
if (!mPlayed) {
- LOG(PR_LOG_DEBUG, ("HTMLMediaElement::mPlayed not available."));
+ LOG(LogLevel::Debug, ("HTMLMediaElement::mPlayed not available."));
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
if (mCurrentPlayRangeStart != -1.0) {
double rangeEndTime = CurrentTime();
- LOG(PR_LOG_DEBUG, ("%p Adding \'played\' a range : [%f, %f]", this, mCurrentPlayRangeStart, rangeEndTime));
+ LOG(LogLevel::Debug, ("%p Adding \'played\' a range : [%f, %f]", this, mCurrentPlayRangeStart, rangeEndTime));
// Multiple seek without playing, or seek while playing.
if (mCurrentPlayRangeStart != rangeEndTime) {
mPlayed->Add(mCurrentPlayRangeStart, rangeEndTime);
}
// Reset the current played range start time. We'll re-set it once
// the seek completes.
mCurrentPlayRangeStart = -1.0;
}
if (!mDecoder) {
- LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) failed: no decoder", this, aTime));
+ LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) failed: no decoder", this, aTime));
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {
- LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) failed: no source", this, aTime));
+ LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) failed: no source", this, aTime));
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
// Clamp the seek target to inside the seekable ranges.
nsRefPtr<dom::TimeRanges> seekable = new dom::TimeRanges();
media::TimeIntervals seekableIntervals = mDecoder->GetSeekable();
if (seekableIntervals.IsInvalid()) {
@@ -1549,31 +1549,31 @@ HTMLMediaElement::Seek(double aTime,
// that requires changing all MediaDecoderReaders to support telling
// us the fastSeek target, and it's currently not possible to get
// this information as we don't yet control the demuxer for all
// MediaDecoderReaders.
mPlayingBeforeSeek = IsPotentiallyPlaying();
// The media backend is responsible for dispatching the timeupdate
// event if it changes the playback position as a result of the seek.
- LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) starting seek", this, aTime));
+ LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) starting seek", this, aTime));
nsresult rv = mDecoder->Seek(aTime, aSeekType);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
// We changed whether we're seeking so we need to AddRemoveSelfReference.
AddRemoveSelfReference();
}
NS_IMETHODIMP HTMLMediaElement::SetCurrentTime(double aCurrentTime)
{
// Detect for a NaN and invalid values.
if (mozilla::IsNaN(aCurrentTime)) {
- LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) failed: bad time", this, aCurrentTime));
+ LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) failed: bad time", this, aCurrentTime));
return NS_ERROR_FAILURE;
}
ErrorResult rv;
SetCurrentTime(aCurrentTime, rv);
return rv.StealNSResult();
}
@@ -1660,17 +1660,17 @@ NS_IMETHODIMP HTMLMediaElement::GetPlaye
return NS_OK;
}
/* void pause (); */
void
HTMLMediaElement::Pause(ErrorResult& aRv)
{
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
- LOG(PR_LOG_DEBUG, ("Loading due to Pause()"));
+ LOG(LogLevel::Debug, ("Loading due to Pause()"));
aRv = Load();
if (aRv.Failed()) {
return;
}
} else if (mDecoder) {
mDecoder->Pause();
}
@@ -2556,17 +2556,17 @@ nsresult HTMLMediaElement::BindToTree(ns
#ifdef MOZ_EME
void
HTMLMediaElement::ReportEMETelemetry()
{
// Report telemetry for EME videos when a page is unloaded.
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
if (mIsEncrypted && Preferences::GetBool("media.eme.enabled")) {
Telemetry::Accumulate(Telemetry::VIDEO_EME_PLAY_SUCCESS, mLoadedDataFired);
- LOG(PR_LOG_DEBUG, ("%p VIDEO_EME_PLAY_SUCCESS = %s",
+ LOG(LogLevel::Debug, ("%p VIDEO_EME_PLAY_SUCCESS = %s",
this, mLoadedDataFired ? "true" : "false"));
}
}
#endif
void
HTMLMediaElement::ReportMSETelemetry()
{
@@ -2608,24 +2608,24 @@ HTMLMediaElement::ReportMSETelemetry()
stalled |= mDecoder && NextFrameStatus() == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING &&
mReadyState == HTMLMediaElement::HAVE_CURRENT_DATA;
if (stalled) {
state = STALLED;
}
}
Telemetry::Accumulate(Telemetry::VIDEO_MSE_UNLOAD_STATE, state);
- LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_UNLOAD_STATE = %d", this, state));
+ LOG(LogLevel::Debug, ("%p VIDEO_MSE_UNLOAD_STATE = %d", this, state));
Telemetry::Accumulate(Telemetry::VIDEO_MSE_PLAY_TIME_MS, SECONDS_TO_MS(mPlayTime.Total()));
- LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_PLAY_TIME_MS = %f", this, mPlayTime.Total()));
+ LOG(LogLevel::Debug, ("%p VIDEO_MSE_PLAY_TIME_MS = %f", this, mPlayTime.Total()));
double latency = mJoinLatency.Count() ? mJoinLatency.Total() / mJoinLatency.Count() : 0.0;
Telemetry::Accumulate(Telemetry::VIDEO_MSE_JOIN_LATENCY_MS, SECONDS_TO_MS(latency));
- LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_JOIN_LATENCY = %f (%d ms) count=%d\n",
+ LOG(LogLevel::Debug, ("%p VIDEO_MSE_JOIN_LATENCY = %f (%d ms) count=%d\n",
this, latency, SECONDS_TO_MS(latency), mJoinLatency.Count()));
}
void HTMLMediaElement::UnbindFromTree(bool aDeep,
bool aNullParent)
{
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
Pause();
@@ -2671,17 +2671,17 @@ HTMLMediaElement::CanPlayType(const nsAS
aResult.AssignLiteral("probably");
break;
default:
case CANPLAY_MAYBE:
aResult.AssignLiteral("maybe");
break;
}
- LOG(PR_LOG_DEBUG, ("%p CanPlayType(%s) = \"%s\"", this,
+ LOG(LogLevel::Debug, ("%p CanPlayType(%s) = \"%s\"", this,
NS_ConvertUTF16toUTF8(aType).get(),
NS_ConvertUTF16toUTF8(aResult).get()));
return NS_OK;
}
nsresult HTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal)
{
@@ -2690,32 +2690,32 @@ nsresult HTMLMediaElement::InitializeDec
MediaResource* originalResource = aOriginal->GetResource();
if (!originalResource)
return NS_ERROR_FAILURE;
nsRefPtr<MediaDecoder> decoder = aOriginal->Clone();
if (!decoder)
return NS_ERROR_FAILURE;
- LOG(PR_LOG_DEBUG, ("%p Cloned decoder %p from %p", this, decoder.get(), aOriginal));
+ LOG(LogLevel::Debug, ("%p Cloned decoder %p from %p", this, decoder.get(), aOriginal));
if (!decoder->Init(this)) {
- LOG(PR_LOG_DEBUG, ("%p Failed to init cloned decoder %p", this, decoder.get()));
+ LOG(LogLevel::Debug, ("%p Failed to init cloned decoder %p", this, decoder.get()));
return NS_ERROR_FAILURE;
}
double duration = aOriginal->GetDuration();
if (duration >= 0) {
decoder->SetDuration(duration);
decoder->SetMediaSeekable(aOriginal->IsMediaSeekable());
}
nsRefPtr<MediaResource> resource = originalResource->CloneData(decoder);
if (!resource) {
- LOG(PR_LOG_DEBUG, ("%p Failed to cloned stream for decoder %p", this, decoder.get()));
+ LOG(LogLevel::Debug, ("%p Failed to cloned stream for decoder %p", this, decoder.get()));
return NS_ERROR_FAILURE;
}
return FinishDecoderSetup(decoder, resource, nullptr, aOriginal);
}
nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
nsIStreamListener** aListener)
@@ -2733,17 +2733,17 @@ nsresult HTMLMediaElement::InitializeDec
nsAutoString src;
GetCurrentSrc(src);
NS_ConvertUTF8toUTF16 mimeUTF16(mimeType);
const char16_t* params[] = { mimeUTF16.get(), src.get() };
ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params));
return NS_ERROR_FAILURE;
}
- LOG(PR_LOG_DEBUG, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get()));
+ LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get()));
nsRefPtr<MediaResource> resource = MediaResource::Create(decoder, aChannel);
if (!resource)
return NS_ERROR_OUT_OF_MEMORY;
// stream successfully created, the stream now owns the channel.
mChannel = nullptr;
@@ -2793,17 +2793,17 @@ nsresult HTMLMediaElement::FinishDecoder
// Update decoder principal before we start decoding, since it
// can affect how we feed data to MediaStreams
NotifyDecoderPrincipalChanged();
nsresult rv = aDecoder->Load(aListener, aCloneDonor);
if (NS_FAILED(rv)) {
SetDecoder(nullptr);
- LOG(PR_LOG_DEBUG, ("%p Failed to load for decoder %p", this, aDecoder));
+ LOG(LogLevel::Debug, ("%p Failed to load for decoder %p", this, aDecoder));
return rv;
}
for (uint32_t i = 0; i < mOutputStreams.Length(); ++i) {
OutputMediaStream* ms = &mOutputStreams[i];
aDecoder->AddOutputStream(ms->mStream->GetStream()->AsProcessedStream(),
ms->mFinishWhenEnded);
}
@@ -3313,17 +3313,17 @@ void HTMLMediaElement::PlaybackEnded()
// Discard all output streams that have finished now.
for (int32_t i = mOutputStreams.Length() - 1; i >= 0; --i) {
if (mOutputStreams[i].mFinishWhenEnded) {
mOutputStreams.RemoveElementAt(i);
}
}
if (mSrcStream || (mDecoder && mDecoder->IsInfinite())) {
- LOG(PR_LOG_DEBUG, ("%p, got duration by reaching the end of the resource", this));
+ LOG(LogLevel::Debug, ("%p, got duration by reaching the end of the resource", this));
DispatchAsyncEvent(NS_LITERAL_STRING("durationchange"));
}
if (HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) {
SetCurrentTime(0);
return;
}
@@ -3604,17 +3604,17 @@ void HTMLMediaElement::ChangeReadyState(
nsMediaReadyState oldState = mReadyState;
mReadyState = aState;
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY ||
oldState == mReadyState) {
return;
}
- LOG(PR_LOG_DEBUG, ("%p Ready state changed to %s", this, gReadyStateToString[aState]));
+ LOG(LogLevel::Debug, ("%p Ready state changed to %s", this, gReadyStateToString[aState]));
UpdateAudioChannelPlayingState();
// Handle raising of "waiting" event during seek (see 4.8.10.9)
if (mPlayingBeforeSeek &&
mReadyState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
}
@@ -3659,17 +3659,17 @@ static const char* const gNetworkStateTo
void HTMLMediaElement::ChangeNetworkState(nsMediaNetworkState aState)
{
if (mNetworkState == aState) {
return;
}
nsMediaNetworkState oldState = mNetworkState;
mNetworkState = aState;
- LOG(PR_LOG_DEBUG, ("%p Network state changed to %s", this, gNetworkStateToString[aState]));
+ LOG(LogLevel::Debug, ("%p Network state changed to %s", this, gNetworkStateToString[aState]));
// TODO: |mBegun| reflects the download status. We should be able to remove
// it and check |mNetworkState| only.
if (oldState == nsIDOMHTMLMediaElement::NETWORK_LOADING) {
// Reset |mBegun| since we're not downloading anymore.
mBegun = false;
// Stop progress notification when exiting NETWORK_LOADING.
@@ -3754,17 +3754,17 @@ VideoFrameContainer* HTMLMediaElement::G
mVideoFrameContainer =
new VideoFrameContainer(this, LayerManager::CreateAsynchronousImageContainer());
return mVideoFrameContainer;
}
nsresult HTMLMediaElement::DispatchEvent(const nsAString& aName)
{
- LOG_EVENT(PR_LOG_DEBUG, ("%p Dispatching event %s", this,
+ LOG_EVENT(LogLevel::Debug, ("%p Dispatching event %s", this,
NS_ConvertUTF16toUTF8(aName).get()));
// Save events that occur while in the bfcache. These will be dispatched
// if the page comes out of the bfcache.
if (mEventDeliveryPaused) {
mPendingEvents.AppendElement(aName);
return NS_OK;
}
@@ -3773,17 +3773,17 @@ nsresult HTMLMediaElement::DispatchEvent
static_cast<nsIContent*>(this),
aName,
false,
false);
}
nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName)
{
- LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing event %s", this,
+ LOG_EVENT(LogLevel::Debug, ("%p Queuing event %s", this,
NS_ConvertUTF16toUTF8(aName).get()));
// Save events that occur while in the bfcache. These will be dispatched
// if the page comes out of the bfcache.
if (mEventDeliveryPaused) {
mPendingEvents.AppendElement(aName);
return NS_OK;
}
@@ -4035,17 +4035,17 @@ nsresult HTMLMediaElement::Observe(nsISu
bool
HTMLMediaElement::IsNodeOfType(uint32_t aFlags) const
{
return !(aFlags & ~(eCONTENT | eMEDIA));
}
void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement)
{
- LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing simple source error event", this));
+ LOG_EVENT(LogLevel::Debug, ("%p Queuing simple source error event", this));
nsCOMPtr<nsIRunnable> event = new nsSourceErrorEventRunner(this, aSourceElement);
NS_DispatchToMainThread(event);
}
void HTMLMediaElement::NotifyAddedSource()
{
// If a source element is inserted as a child of a media element
@@ -4120,17 +4120,17 @@ nsIContent* HTMLMediaElement::GetNextSou
void HTMLMediaElement::ChangeDelayLoadStatus(bool aDelay)
{
if (mDelayingLoadEvent == aDelay)
return;
mDelayingLoadEvent = aDelay;
- LOG(PR_LOG_DEBUG, ("%p ChangeDelayLoadStatus(%d) doc=0x%p", this, aDelay, mLoadBlockedDoc.get()));
+ LOG(LogLevel::Debug, ("%p ChangeDelayLoadStatus(%d) doc=0x%p", this, aDelay, mLoadBlockedDoc.get()));
if (mDecoder) {
mDecoder->SetLoadInBackground(!aDelay);
}
if (aDelay) {
mLoadBlockedDoc = OwnerDoc();
mLoadBlockedDoc->BlockOnload();
} else {
// mLoadBlockedDoc might be null due to GC unlinking
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -190,17 +190,17 @@ HTMLTrackElement::LoadResource()
nsAutoString src;
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
return;
}
nsCOMPtr<nsIURI> uri;
nsresult rv = NewURIFromString(src, getter_AddRefs(uri));
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
- LOG(PR_LOG_INFO, ("%p Trying to load from src=%s", this,
+ LOG(LogLevel::Info, ("%p Trying to load from src=%s", this,
NS_ConvertUTF16toUTF8(src).get()));
if (mChannel) {
mChannel->Cancel(NS_BINDING_ABORTED);
mChannel = nullptr;
}
rv = nsContentUtils::GetSecurityManager()->
@@ -241,17 +241,17 @@ HTMLTrackElement::LoadResource()
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
mListener = new WebVTTListener(this);
rv = mListener->LoadResource();
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
channel->SetNotificationCallbacks(mListener);
- LOG(PR_LOG_DEBUG, ("opening webvtt channel"));
+ LOG(LogLevel::Debug, ("opening webvtt channel"));
rv = channel->AsyncOpen(mListener, nullptr);
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
mChannel = channel;
}
nsresult
HTMLTrackElement::BindToTree(nsIDocument* aDocument,
@@ -264,29 +264,29 @@ HTMLTrackElement::BindToTree(nsIDocument
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
if (!aDocument) {
return NS_OK;
}
- LOG(PR_LOG_DEBUG, ("Track Element bound to tree."));
+ LOG(LogLevel::Debug, ("Track Element bound to tree."));
if (!aParent || !aParent->IsNodeOfType(nsINode::eMEDIA)) {
return NS_OK;
}
// Store our parent so we can look up its frame for display.
if (!mMediaParent) {
mMediaParent = static_cast<HTMLMediaElement*>(aParent);
HTMLMediaElement* media = static_cast<HTMLMediaElement*>(aParent);
// TODO: separate notification for 'alternate' tracks?
media->NotifyAddedSource();
- LOG(PR_LOG_DEBUG, ("Track element sent notification to parent."));
+ LOG(LogLevel::Debug, ("Track element sent notification to parent."));
mMediaParent->RunInStableState(
NS_NewRunnableMethod(this, &HTMLTrackElement::LoadResource));
}
return NS_OK;
}
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -102,17 +102,17 @@
#if DISABLE_ASSERTS_FOR_FUZZING
#define ASSERT_UNLESS_FUZZING(...) do { } while (0)
#else
#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
#endif
#define IDB_DEBUG_LOG(_args) \
MOZ_LOG(IndexedDatabaseManager::GetLoggingModule(), \
- PR_LOG_DEBUG, \
+ LogLevel::Debug, \
_args )
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#define IDB_MOBILE
#endif
namespace mozilla {
namespace dom {
--- a/dom/indexedDB/ProfilerHelpers.h
+++ b/dom/indexedDB/ProfilerHelpers.h
@@ -277,17 +277,17 @@ LoggingHelper(bool aUseProfiler, const c
{
MOZ_ASSERT(IndexedDatabaseManager::GetLoggingMode() !=
IndexedDatabaseManager::Logging_Disabled);
MOZ_ASSERT(aFmt);
PRLogModuleInfo* logModule = IndexedDatabaseManager::GetLoggingModule();
MOZ_ASSERT(logModule);
- static const PRLogModuleLevel logLevel = PR_LOG_WARNING;
+ static const mozilla::LogLevel logLevel = LogLevel::Warning;
if (MOZ_LOG_TEST(logModule, logLevel) ||
(aUseProfiler && profiler_is_active())) {
nsAutoCString message;
{
va_list args;
va_start(args, aFmt);
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -72,20 +72,20 @@
GetPPMLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("ProcessPriorityManager");
return sLog;
}
# define LOG(fmt, ...) \
- MOZ_LOG(GetPPMLog(), PR_LOG_DEBUG, \
+ MOZ_LOG(GetPPMLog(), LogLevel::Debug, \
("ProcessPriorityManager - " fmt, ##__VA_ARGS__))
# define LOGP(fmt, ...) \
- MOZ_LOG(GetPPMLog(), PR_LOG_DEBUG, \
+ MOZ_LOG(GetPPMLog(), LogLevel::Debug, \
("ProcessPriorityManager[%schild-id=%" PRIu64 ", pid=%d] - " fmt, \
NameWithComma().get(), \
static_cast<uint64_t>(ChildID()), Pid(), ##__VA_ARGS__))
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
--- a/dom/media/AudioSink.cpp
+++ b/dom/media/AudioSink.cpp
@@ -7,19 +7,19 @@
#include "MediaDecoderStateMachine.h"
#include "AudioStream.h"
#include "prenv.h"
namespace mozilla {
extern PRLogModuleInfo* gMediaDecoderLog;
#define SINK_LOG(msg, ...) \
- MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
+ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
#define SINK_LOG_V(msg, ...) \
- MOZ_LOG(gMediaDecoderLog, PR_LOG_VERBOSE, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
+ MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
AudioSink::OnAudioEndTimeUpdateTask::OnAudioEndTimeUpdateTask(
MediaDecoderStateMachine* aStateMachine)
: mMutex("OnAudioEndTimeUpdateTask")
, mEndTime(0)
, mStateMachine(aStateMachine)
{
}
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -26,17 +26,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
PRLogModuleInfo* gAudioStreamLog = nullptr;
// For simple logs
-#define LOG(x) MOZ_LOG(gAudioStreamLog, PR_LOG_DEBUG, x)
+#define LOG(x) MOZ_LOG(gAudioStreamLog, mozilla::LogLevel::Debug, x)
/**
* When MOZ_DUMP_AUDIO is set in the environment (to anything),
* we'll drop a series of files in the current working directory named
* dumped-audio-<nnn>.wav, one per AudioStream created, containing
* the audio for the stream including any skips due to underruns.
*/
static int gDumpedAudioCount = 0;
@@ -325,17 +325,17 @@ AudioStream::Init(int32_t aNumChannels,
{
mStartTime = TimeStamp::Now();
mIsFirst = CubebUtils::GetFirstStream();
if (!CubebUtils::GetCubebContext() || aNumChannels < 0 || aRate < 0) {
return NS_ERROR_FAILURE;
}
- MOZ_LOG(gAudioStreamLog, PR_LOG_DEBUG,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Debug,
("%s channels: %d, rate: %d for %p", __FUNCTION__, aNumChannels, aRate, this));
mInRate = mOutRate = aRate;
mChannels = aNumChannels;
mOutChannels = (aNumChannels > 2) ? 2 : aNumChannels;
mLatencyRequest = aLatencyRequest;
mDumpFile = OpenDumpFile(this);
@@ -542,22 +542,22 @@ AudioStream::CheckForStart()
mMonitor.AssertCurrentThreadOwns();
if (mState == INITIALIZED) {
// Start the stream right away when low latency has been requested. This means
// that the DataCallback will feed silence to cubeb, until the first frames
// are written to this AudioStream. Also start if a start has been queued.
if (mLatencyRequest == LowLatency || mNeedsStart) {
StartUnlocked(); // mState = STARTED or ERRORED
mNeedsStart = false;
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
("Started waiting %s-latency stream",
mLatencyRequest == LowLatency ? "low" : "high"));
} else {
// high latency, not full - OR Pause() was called before we got here
- MOZ_LOG(gAudioStreamLog, PR_LOG_DEBUG,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Debug,
("Not starting waiting %s-latency stream",
mLatencyRequest == LowLatency ? "low" : "high"));
}
}
}
NS_IMETHODIMP
AudioInitTask::Run()
@@ -607,17 +607,17 @@ AudioStream::Write(const AudioDataValue*
else if (mChannels > 8) {
return NS_ERROR_FAILURE;
}
const uint8_t* src = reinterpret_cast<const uint8_t*>(aBuf);
uint32_t bytesToCopy = FramesToBytes(aFrames);
// XXX this will need to change if we want to enable this on-the-fly!
- if (MOZ_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
// Record the position and time this data was inserted
int64_t timeMs;
if (aTime && !aTime->IsNull()) {
if (mStartTime.IsNull()) {
AsyncLatencyLogger::Get(true)->GetStartTime(mStartTime);
}
timeMs = (*aTime - mStartTime).ToMilliseconds();
} else {
@@ -640,32 +640,32 @@ AudioStream::Write(const AudioDataValue*
// Careful - the CubebInit thread may not have gotten to STARTED yet
if ((mState == INITIALIZED || mState == STARTED) && mLatencyRequest == LowLatency) {
// don't ever block MediaStreamGraph low-latency streams
uint32_t remains = 0; // we presume the buffer is full
if (mBuffer.Length() > bytesToCopy) {
remains = mBuffer.Length() - bytesToCopy; // Free up just enough space
}
// account for dropping samples
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p dropping %u bytes (%u frames)in Write()",
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Stream %p dropping %u bytes (%u frames)in Write()",
this, mBuffer.Length() - remains, BytesToFrames(mBuffer.Length() - remains)));
mReadPoint += BytesToFrames(mBuffer.Length() - remains);
mBuffer.ContractTo(remains);
} else { // RUNNING or high latency
// If we are not playing, but our buffer is full, start playing to make
// room for soon-to-be-decoded data.
if (mState != STARTED && mState != RUNNING) {
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Starting stream %p in Write (%u waiting)",
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Starting stream %p in Write (%u waiting)",
this, bytesToCopy));
StartUnlocked();
if (mState == ERRORED) {
return NS_ERROR_FAILURE;
}
}
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p waiting in Write() (%u waiting)",
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Stream %p waiting in Write() (%u waiting)",
this, bytesToCopy));
mon.Wait();
}
}
}
mWritten += aFrames;
return NS_OK;
@@ -1068,26 +1068,26 @@ AudioStream::DataCallback(void* aBuffer,
// we start getting callbacks.
// Simple version - contract on first callback only.
if (mLatencyRequest == LowLatency) {
uint32_t old_len = mBuffer.Length();
available = mBuffer.ContractTo(FramesToBytes(aFrames));
TimeStamp now = TimeStamp::Now();
if (!mStartTime.IsNull()) {
int64_t timeMs = (now - mStartTime).ToMilliseconds();
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
("Stream took %lldms to start after first Write() @ %u", timeMs, mOutRate));
} else {
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
("Stream started before Write() @ %u", mOutRate));
}
if (old_len != available) {
// Note that we may have dropped samples in Write() as well!
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
("AudioStream %p dropped %u + %u initial frames @ %u", this,
mReadPoint, BytesToFrames(old_len - available), mOutRate));
mReadPoint += BytesToFrames(old_len - available);
}
}
mState = RUNNING;
}
@@ -1118,27 +1118,27 @@ AudioStream::DataCallback(void* aBuffer,
// Always send audible frames first, and silent frames later.
// Otherwise it will break the assumption of FrameHistory.
if (mState != DRAINING) {
mAudioClock.UpdateFrameHistory(servicedFrames, underrunFrames);
uint8_t* rpos = static_cast<uint8_t*>(aBuffer) + FramesToBytes(aFrames - underrunFrames);
memset(rpos, 0, FramesToBytes(underrunFrames));
if (underrunFrames) {
- MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
+ MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
("AudioStream %p lost %d frames", this, underrunFrames));
}
servicedFrames += underrunFrames;
} else {
mAudioClock.UpdateFrameHistory(servicedFrames, 0);
}
WriteDumpFile(mDumpFile, this, aFrames, aBuffer);
// Don't log if we're not interested or if the stream is inactive
- if (MOZ_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG) &&
+ if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug) &&
mState != SHUTDOWN &&
insertTime != INT64_MAX && servicedFrames > underrunFrames) {
uint32_t latency = UINT32_MAX;
if (cubeb_stream_get_latency(mCubebStream.get(), &latency)) {
NS_WARNING("Could not get latency from cubeb.");
}
TimeStamp now = TimeStamp::Now();
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -64,17 +64,17 @@ void GraphDriver::SetGraphTime(GraphDriv
// does an iteration is to update graph times, so we are in fact setting
// mIterationStart of the next iteration by setting the end of the previous
// iteration.
mIterationStart = aLastSwitchNextIterationStart;
mIterationEnd = aLastSwitchNextIterationEnd;
mStateComputedTime = aLastSwitchStateComputedTime;
mNextStateComputedTime = aLastSwitchNextStateComputedTime;
- STREAM_LOG(PR_LOG_DEBUG, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver"));
+ STREAM_LOG(LogLevel::Debug, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver"));
MOZ_ASSERT(!mPreviousDriver);
mPreviousDriver = aPreviousDriver;
}
void GraphDriver::SwitchAtNextIteration(GraphDriver* aNextDriver)
{
// This is the situation where `mPreviousDriver` is an AudioCallbackDriver
// that is switching device, and the graph has found the current driver is not
@@ -177,17 +177,17 @@ class MediaStreamGraphInitThreadRunnable
public:
explicit MediaStreamGraphInitThreadRunnable(ThreadedDriver* aDriver)
: mDriver(aDriver)
{
}
NS_IMETHOD Run()
{
char aLocal;
- STREAM_LOG(PR_LOG_DEBUG, ("Starting system thread"));
+ STREAM_LOG(LogLevel::Debug, ("Starting system thread"));
profiler_register_thread("MediaStreamGraph", &aLocal);
LIFECYCLE_LOG("Starting a new system driver for graph %p\n",
mDriver->mGraphImpl);
if (mDriver->mPreviousDriver) {
LIFECYCLE_LOG("%p releasing an AudioCallbackDriver(%p), for graph %p\n",
mDriver,
mDriver->mPreviousDriver.get(),
mDriver->GraphImpl());
@@ -231,17 +231,17 @@ ThreadedDriver::Resume()
Start();
}
void
ThreadedDriver::Revive()
{
// Note: only called on MainThread, without monitor
// We know were weren't in a running state
- STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver reviving."));
+ STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver reviving."));
// If we were switching, switch now. Otherwise, tell thread to run the main
// loop again.
MonitorAutoLock mon(mGraphImpl->GetMonitor());
if (mNextDriver) {
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
mNextDriver->Start();
@@ -251,17 +251,17 @@ ThreadedDriver::Revive()
}
}
void
ThreadedDriver::Stop()
{
NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
// mGraph's thread is not running so it's OK to do whatever here
- STREAM_LOG(PR_LOG_DEBUG, ("Stopping threads for MediaStreamGraph %p", this));
+ STREAM_LOG(LogLevel::Debug, ("Stopping threads for MediaStreamGraph %p", this));
if (mThread) {
mThread->Shutdown();
mThread = nullptr;
}
}
SystemClockDriver::SystemClockDriver(MediaStreamGraphImpl* aGraphImpl)
@@ -282,30 +282,30 @@ ThreadedDriver::RunThread()
while (stillProcessing) {
GraphTime prevCurrentTime, nextCurrentTime;
GetIntervalForIteration(prevCurrentTime, nextCurrentTime);
mStateComputedTime = mNextStateComputedTime;
mNextStateComputedTime =
mGraphImpl->RoundUpToNextAudioBlock(
nextCurrentTime + mGraphImpl->MillisecondsToMediaTime(AUDIO_TARGET_MS));
- STREAM_LOG(PR_LOG_DEBUG,
+ STREAM_LOG(LogLevel::Debug,
("interval[%ld; %ld] state[%ld; %ld]",
(long)mIterationStart, (long)mIterationEnd,
(long)mStateComputedTime, (long)mNextStateComputedTime));
mGraphImpl->mFlushSourcesNow = mGraphImpl->mFlushSourcesOnNextIteration;
mGraphImpl->mFlushSourcesOnNextIteration = false;
stillProcessing = mGraphImpl->OneIteration(prevCurrentTime,
nextCurrentTime,
StateComputedTime(),
mNextStateComputedTime);
if (mNextDriver && stillProcessing) {
- STREAM_LOG(PR_LOG_DEBUG, ("Switching to AudioCallbackDriver"));
+ STREAM_LOG(LogLevel::Debug, ("Switching to AudioCallbackDriver"));
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
mNextDriver->Start();
return;
}
}
}
@@ -314,30 +314,30 @@ void
SystemClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo)
{
TimeStamp now = TimeStamp::Now();
aFrom = mIterationStart = IterationEnd();
aTo = mIterationEnd = mGraphImpl->SecondsToMediaTime((now - mCurrentTimeStamp).ToSeconds()) + IterationEnd();
mCurrentTimeStamp = now;
- MOZ_LOG(gMediaStreamGraphLog, PR_LOG_VERBOSE, ("Updating current time to %f (real %f, mStateComputedTime %f)",
+ MOZ_LOG(gMediaStreamGraphLog, LogLevel::Verbose, ("Updating current time to %f (real %f, mStateComputedTime %f)",
mGraphImpl->MediaTimeToSeconds(aTo),
(now - mInitialTimeStamp).ToSeconds(),
mGraphImpl->MediaTimeToSeconds(StateComputedTime())));
if (mStateComputedTime < aTo) {
- STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
+ STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
aTo = mIterationEnd = mStateComputedTime;
}
if (aFrom >= aTo) {
NS_ASSERTION(aFrom == aTo , "Time can't go backwards!");
// This could happen due to low clock resolution, maybe?
- STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance"));
+ STREAM_LOG(LogLevel::Debug, ("Time did not advance"));
}
}
GraphTime
SystemClockDriver::GetCurrentTime()
{
return IterationEnd();
}
@@ -358,28 +358,28 @@ SystemClockDriver::WaitForNextIteration(
TimeStamp now = TimeStamp::Now();
if (mGraphImpl->mNeedAnotherIteration) {
int64_t timeoutMS = MEDIA_GRAPH_TARGET_PERIOD_MS -
int64_t((now - mCurrentTimeStamp).ToMilliseconds());
// Make sure timeoutMS doesn't overflow 32 bits by waking up at
// least once a minute, if we need to wake up at all
timeoutMS = std::max<int64_t>(0, std::min<int64_t>(timeoutMS, 60*1000));
timeout = PR_MillisecondsToInterval(uint32_t(timeoutMS));
- STREAM_LOG(PR_LOG_VERBOSE, ("Waiting for next iteration; at %f, timeout=%f", (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
+ STREAM_LOG(LogLevel::Verbose, ("Waiting for next iteration; at %f, timeout=%f", (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
if (mWaitState == WAITSTATE_WAITING_INDEFINITELY) {
mGraphImpl->mGraphDriverAsleep = false; // atomic
}
mWaitState = WAITSTATE_WAITING_FOR_NEXT_ITERATION;
} else {
mGraphImpl->mGraphDriverAsleep = true; // atomic
mWaitState = WAITSTATE_WAITING_INDEFINITELY;
}
if (timeout > 0) {
mGraphImpl->GetMonitor().Wait(timeout);
- STREAM_LOG(PR_LOG_VERBOSE, ("Resuming after timeout; at %f, elapsed=%f",
+ STREAM_LOG(LogLevel::Verbose, ("Resuming after timeout; at %f, elapsed=%f",
(TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
(TimeStamp::Now() - now).ToSeconds()));
}
if (mWaitState == WAITSTATE_WAITING_INDEFINITELY) {
mGraphImpl->mGraphDriverAsleep = false; // atomic
}
mWaitState = WAITSTATE_RUNNING;
@@ -434,24 +434,24 @@ OfflineClockDriver::~OfflineClockDriver(
void
OfflineClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo)
{
aFrom = mIterationStart = IterationEnd();
aTo = mIterationEnd = IterationEnd() + mGraphImpl->MillisecondsToMediaTime(mSlice);
if (mStateComputedTime < aTo) {
- STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
+ STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
aTo = mIterationEnd = mStateComputedTime;
}
if (aFrom >= aTo) {
NS_ASSERTION(aFrom == aTo , "Time can't go backwards!");
// This could happen due to low clock resolution, maybe?
- STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance"));
+ STREAM_LOG(LogLevel::Debug, ("Time did not advance"));
}
}
GraphTime
OfflineClockDriver::GetCurrentTime()
{
return mIterationEnd;
}
@@ -540,17 +540,17 @@ AudioCallbackDriver::AudioCallbackDriver
, mStarted(false)
, mAudioChannel(aChannel)
, mInCallback(false)
, mPauseRequested(false)
#ifdef XP_MACOSX
, mCallbackReceivedWhileSwitching(0)
#endif
{
- STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
+ STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
}
AudioCallbackDriver::~AudioCallbackDriver()
{
MOZ_ASSERT(mPromisesForOperation.IsEmpty());
}
void
@@ -608,48 +608,48 @@ AudioCallbackDriver::Init()
return;
}
cubeb_stream_register_device_changed_callback(mAudioStream,
AudioCallbackDriver::DeviceChangedCallback_s);
StartStream();
- STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver started."));
+ STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver started."));
}
void
AudioCallbackDriver::Destroy()
{
- STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver destroyed."));
+ STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver destroyed."));
mAudioStream.reset();
}
void
AudioCallbackDriver::Resume()
{
- STREAM_LOG(PR_LOG_DEBUG, ("Resuming audio threads for MediaStreamGraph %p", mGraphImpl));
+ STREAM_LOG(LogLevel::Debug, ("Resuming audio threads for MediaStreamGraph %p", mGraphImpl));
if (cubeb_stream_start(mAudioStream) != CUBEB_OK) {
NS_WARNING("Could not start cubeb stream for MSG.");
}
}
void
AudioCallbackDriver::Start()
{
// If this is running on the main thread, we can't open the stream directly,
// because it is a blocking operation.
if (NS_IsMainThread()) {
- STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
+ STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
nsRefPtr<AsyncCubebTask> initEvent =
new AsyncCubebTask(this, AsyncCubebOperation::INIT);
initEvent->Dispatch();
} else {
- STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from the previous driver's thread", mGraphImpl));
+ STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from the previous driver's thread", mGraphImpl));
Init();
// Check if we need to resolve promises because the driver just got switched
// because of a resuming AudioContext
if (!mPromisesForOperation.IsEmpty()) {
CompleteAudioContextOperations(AsyncCubebOperation::INIT);
}
@@ -684,26 +684,26 @@ AudioCallbackDriver::Stop()
}
}
void
AudioCallbackDriver::Revive()
{
// Note: only called on MainThread, without monitor
// We know were weren't in a running state
- STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver reviving."));
+ STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver reviving."));
// If we were switching, switch now. Otherwise, start the audio thread again.
MonitorAutoLock mon(mGraphImpl->GetMonitor());
if (mNextDriver) {
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
mNextDriver->Start();
} else {
- STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
+ STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
nsRefPtr<AsyncCubebTask> initEvent =
new AsyncCubebTask(this, AsyncCubebOperation::INIT);
initEvent->Dispatch();
}
}
void
AudioCallbackDriver::GetIntervalForIteration(GraphTime& aFrom,
@@ -777,19 +777,19 @@ bool
AudioCallbackDriver::OSXDeviceSwitchingWorkaround()
{
MonitorAutoLock mon(GraphImpl()->GetMonitor());
if (mSelfReference) {
// Apparently, depending on the osx version, on device switch, the
// callback is called "some" number of times, and then stops being called,
// and then gets called again. 10 is to be safe, it's a low-enough number
// of milliseconds anyways (< 100ms)
- //STREAM_LOG(PR_LOG_DEBUG, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1));
+ //STREAM_LOG(LogLevel::Debug, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1));
if (mCallbackReceivedWhileSwitching++ >= 10) {
- STREAM_LOG(PR_LOG_DEBUG, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching));
+ STREAM_LOG(LogLevel::Debug, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching));
// If we have a self reference, we have fallen back temporarily on a
// system clock driver, but we just got called back, that means the osx
// audio backend has switched to the new device.
// Ask the graph to switch back to the previous AudioCallbackDriver
// (`this`), and when the graph has effectively switched, we can drop
// the self reference and unref the SystemClockDriver we fallen back on.
if (GraphImpl()->CurrentDriver() == this) {
mSelfReference.Drop(this);
@@ -878,26 +878,26 @@ AudioCallbackDriver::DataCallback(AudioD
// We want the interval [mIterationStart; mIterationEnd] to be before the
// interval [mStateComputedTime; mNextStateComputedTime]. We also want
// the distance between these intervals to be roughly equivalent each time, to
// ensure there is no clock drift between current time and state time. Since
// we can't act on the state time because we have to fill the audio buffer, we
// reclock the current time against the state time, here.
mIterationEnd = mIterationStart + 0.8 * inGraph;
- STREAM_LOG(PR_LOG_DEBUG, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n",
+ STREAM_LOG(LogLevel::Debug, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n",
(long)mIterationStart, (long)mIterationEnd,
(long)mStateComputedTime, (long)mNextStateComputedTime,
(long)aFrames, (uint32_t)durationMS,
(long)(mNextStateComputedTime - mStateComputedTime)));
mCurrentTimeStamp = TimeStamp::Now();
if (mStateComputedTime < mIterationEnd) {
- STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
+ STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
mIterationEnd = mStateComputedTime;
}
stillProcessing = mGraphImpl->OneIteration(mIterationStart,
mIterationEnd,
mStateComputedTime,
mNextStateComputedTime);
} else {
@@ -911,17 +911,17 @@ AudioCallbackDriver::DataCallback(AudioD
{
// If the audio stream has not been started by the previous driver or
// the graph itself, keep it alive.
MonitorAutoLock mon(mGraphImpl->GetMonitor());
if (!IsStarted()) {
return aFrames;
}
}
- STREAM_LOG(PR_LOG_DEBUG, ("Switching to system driver."));
+ STREAM_LOG(LogLevel::Debug, ("Switching to system driver."));
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
mNextDriver->Start();
// Returning less than aFrames starts the draining and eventually stops the
// audio thread. This function will never get called again.
return aFrames - 1;
}
@@ -931,17 +931,17 @@ AudioCallbackDriver::DataCallback(AudioD
return aFrames - 1;
}
return aFrames;
}
void
AudioCallbackDriver::StateCallback(cubeb_state aState)
{
- STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver State: %d", aState));
+ STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState));
}
void
AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer,
AudioSampleFormat aFormat,
uint32_t aChannels,
uint32_t aFrames,
uint32_t aSampleRate)
@@ -1015,17 +1015,17 @@ AudioCallbackDriver::DeviceChangedCallba
// SourceMediaStream.
if (!GraphImpl()->Running()) {
return;
}
if (mSelfReference) {
return;
}
- STREAM_LOG(PR_LOG_ERROR, ("Switching to SystemClockDriver during output switch"));
+ STREAM_LOG(LogLevel::Error, ("Switching to SystemClockDriver during output switch"));
mSelfReference.Take(this);
mCallbackReceivedWhileSwitching = 0;
mGraphImpl->mFlushSourcesOnNextIteration = true;
mNextDriver = new SystemClockDriver(GraphImpl());
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
mNextDriver->Start();
--- a/dom/media/Latency.cpp
+++ b/dom/media/Latency.cpp
@@ -186,21 +186,21 @@ AsyncLatencyLogger::Observe(nsISupports*
return NS_OK;
}
// aID is a sub-identifier (in particular a specific MediaStramTrack)
void AsyncLatencyLogger::WriteLog(LatencyLogIndex aIndex, uint64_t aID, int64_t aValue,
TimeStamp aTimeStamp)
{
if (aTimeStamp.IsNull()) {
- MOZ_LOG(GetLatencyLog(), PR_LOG_DEBUG,
+ MOZ_LOG(GetLatencyLog(), LogLevel::Debug,
("Latency: %s,%llu,%lld,%lld",
LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue));
} else {
- MOZ_LOG(GetLatencyLog(), PR_LOG_DEBUG,
+ MOZ_LOG(GetLatencyLog(), LogLevel::Debug,
("Latency: %s,%llu,%lld,%lld,%lld",
LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue,
static_cast<int64_t>((aTimeStamp - gAsyncLogger->mStart).ToMilliseconds())));
}
}
int64_t AsyncLatencyLogger::GetTimeStamp()
{
@@ -211,15 +211,15 @@ int64_t AsyncLatencyLogger::GetTimeStamp
void AsyncLatencyLogger::Log(LatencyLogIndex aIndex, uint64_t aID, int64_t aValue)
{
TimeStamp null;
Log(aIndex, aID, aValue, null);
}
void AsyncLatencyLogger::Log(LatencyLogIndex aIndex, uint64_t aID, int64_t aValue, TimeStamp &aTime)
{
- if (MOZ_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
nsCOMPtr<nsIRunnable> event = new LogEvent(aIndex, aID, aValue, aTime);
if (mThread) {
mThread->Dispatch(event, NS_DISPATCH_NORMAL);
}
}
}
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -950,17 +950,17 @@ MediaCache::FreeBlock(int32_t aBlock)
mReentrantMonitor.AssertCurrentThreadIn();
Block* block = &mIndex[aBlock];
if (block->mOwners.IsEmpty()) {
// already free
return;
}
- CACHE_LOG(PR_LOG_DEBUG, ("Released block %d", aBlock));
+ CACHE_LOG(LogLevel::Debug, ("Released block %d", aBlock));
for (uint32_t i = 0; i < block->mOwners.Length(); ++i) {
BlockOwner* bo = &block->mOwners[i];
GetListForBlock(bo)->RemoveBlock(aBlock);
bo->mStream->mBlocks[bo->mStreamBlock] = -1;
}
block->mOwners.Clear();
mFreeBlocks.AddFirstBlock(aBlock);
@@ -1116,27 +1116,27 @@ MediaCache::Update()
PredictNextUse(now, destinationBlockIndex) > latestPredictedUseForOverflow) {
// Reuse blocks in the main part of the cache that are less useful than
// the least useful overflow blocks
nsresult rv = mFileCache->MoveBlock(blockIndex, destinationBlockIndex);
if (NS_SUCCEEDED(rv)) {
// We successfully copied the file data.
- CACHE_LOG(PR_LOG_DEBUG, ("Swapping blocks %d and %d (trimming cache)",
+ CACHE_LOG(LogLevel::Debug, ("Swapping blocks %d and %d (trimming cache)",
blockIndex, destinationBlockIndex));
// Swapping the block metadata here lets us maintain the
// correct positions in the linked lists
SwapBlocks(blockIndex, destinationBlockIndex);
//Free the overflowing block even if the copy failed.
- CACHE_LOG(PR_LOG_DEBUG, ("Released block %d (trimming cache)", blockIndex));
+ CACHE_LOG(LogLevel::Debug, ("Released block %d (trimming cache)", blockIndex));
FreeBlock(blockIndex);
}
} else {
- CACHE_LOG(PR_LOG_DEBUG, ("Could not trim cache block %d (destination %d, predicted next use %f, latest predicted use for overflow %f",
+ CACHE_LOG(LogLevel::Debug, ("Could not trim cache block %d (destination %d, predicted next use %f, latest predicted use for overflow %f",
blockIndex, destinationBlockIndex,
PredictNextUse(now, destinationBlockIndex).ToSeconds(),
latestPredictedUseForOverflow.ToSeconds()));
}
}
// Try chopping back the array of cache entries and the cache file.
Truncate();
@@ -1164,17 +1164,17 @@ MediaCache::Update()
int32_t resumeThreshold = Preferences::GetInt("media.cache_resume_threshold", 10);
int32_t readaheadLimit = Preferences::GetInt("media.cache_readahead_limit", 30);
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
actions.AppendElement(NONE);
MediaCacheStream* stream = mStreams[i];
if (stream->mClosed) {
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p closed", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p closed", stream));
continue;
}
// Figure out where we should be reading from. It's the first
// uncached byte after the current mStreamOffset.
int64_t dataOffset = stream->GetCachedDataEndInternal(stream->mStreamOffset);
MOZ_ASSERT(dataOffset >= 0);
@@ -1215,79 +1215,79 @@ MediaCache::Update()
// read. We don't want to try to read if we're suspended, because that
// might create a new channel and seek unnecessarily (and incorrectly,
// since HTTP doesn't allow seeking to the actual EOF), and we don't want
// to suspend if we're not suspended and already reading at the end of
// the stream, since there just might be more data than the server
// advertised with Content-Length, and we may as well keep reading.
// But we don't want to seek to the end of the stream if we're not
// already there.
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p at end of stream", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p at end of stream", stream));
enableReading = !stream->mCacheSuspended &&
stream->mStreamLength == stream->mChannelOffset;
} else if (desiredOffset < stream->mStreamOffset) {
// We're reading to try to catch up to where the current stream
// reader wants to be. Better not stop.
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p catching up", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p catching up", stream));
enableReading = true;
} else if (desiredOffset < stream->mStreamOffset + BLOCK_SIZE) {
// The stream reader is waiting for us, or nearly so. Better feed it.
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p feeding reader", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p feeding reader", stream));
enableReading = true;
} else if (!stream->mIsTransportSeekable &&
nonSeekableReadaheadBlockCount >= maxBlocks*NONSEEKABLE_READAHEAD_MAX) {
// This stream is not seekable and there are already too many blocks
// being cached for readahead for nonseekable streams (which we can't
// free). So stop reading ahead now.
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling non-seekable readahead", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p throttling non-seekable readahead", stream));
enableReading = false;
} else if (mIndex.Length() > uint32_t(maxBlocks)) {
// We're in the process of bringing the cache size back to the
// desired limit, so don't bring in more data yet
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling to reduce cache size", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p throttling to reduce cache size", stream));
enableReading = false;
} else {
TimeDuration predictedNewDataUse = PredictNextUseForIncomingData(stream);
if (stream->mCacheSuspended &&
predictedNewDataUse.ToSeconds() > resumeThreshold) {
// Don't need data for a while, so don't bother waking up the stream
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p avoiding wakeup since more data is not needed", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p avoiding wakeup since more data is not needed", stream));
enableReading = false;
} else if (predictedNewDataUse.ToSeconds() > readaheadLimit) {
// Don't read ahead more than this much
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling to avoid reading ahead too far", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p throttling to avoid reading ahead too far", stream));
enableReading = false;
} else if (freeBlockCount > 0) {
// Free blocks in the cache, so keep reading
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p reading since there are free blocks", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p reading since there are free blocks", stream));
enableReading = true;
} else if (latestNextUse <= TimeDuration(0)) {
// No reusable blocks, so can't read anything
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling due to no reusable blocks", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p throttling due to no reusable blocks", stream));
enableReading = false;
} else {
// Read ahead if the data we expect to read is more valuable than
// the least valuable block in the main part of the cache
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p predict next data in %f, current worst block is %f",
+ CACHE_LOG(LogLevel::Debug, ("Stream %p predict next data in %f, current worst block is %f",
stream, predictedNewDataUse.ToSeconds(), latestNextUse.ToSeconds()));
enableReading = predictedNewDataUse < latestNextUse;
}
}
if (enableReading) {
for (uint32_t j = 0; j < i; ++j) {
MediaCacheStream* other = mStreams[j];
if (other->mResourceID == stream->mResourceID &&
!other->mClosed && !other->mClient->IsSuspended() &&
other->mChannelOffset/BLOCK_SIZE == desiredOffset/BLOCK_SIZE) {
// This block is already going to be read by the other stream.
// So don't try to read it from this stream as well.
enableReading = false;
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p waiting on same block (%lld) from stream %p",
+ CACHE_LOG(LogLevel::Debug, ("Stream %p waiting on same block (%lld) from stream %p",
stream, desiredOffset/BLOCK_SIZE, other));
break;
}
}
}
if (stream->mChannelOffset != desiredOffset && enableReading) {
// We need to seek now.
@@ -1341,28 +1341,28 @@ MediaCache::Update()
}
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
MediaCacheStream* stream = mStreams[i];
nsresult rv;
switch (actions[i]) {
case SEEK:
case SEEK_AND_RESUME:
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p CacheSeek to %lld (resume=%d)", stream,
+ CACHE_LOG(LogLevel::Debug, ("Stream %p CacheSeek to %lld (resume=%d)", stream,
(long long)stream->mChannelOffset, actions[i] == SEEK_AND_RESUME));
rv = stream->mClient->CacheClientSeek(stream->mChannelOffset,
actions[i] == SEEK_AND_RESUME);
break;
case RESUME:
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Resumed", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p Resumed", stream));
rv = stream->mClient->CacheClientResume();
QueueSuspendedStatusUpdate(stream->mResourceID);
break;
case SUSPEND:
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Suspended", stream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p Suspended", stream));
rv = stream->mClient->CacheClientSuspend();
QueueSuspendedStatusUpdate(stream->mResourceID);
break;
default:
rv = NS_OK;
break;
}
@@ -1492,31 +1492,31 @@ MediaCache::AllocateAndWriteBlock(MediaC
ResourceStreamIterator iter(aStream->mResourceID);
while (MediaCacheStream* stream = iter.Next()) {
while (streamBlockIndex >= int32_t(stream->mBlocks.Length())) {
stream->mBlocks.AppendElement(-1);
}
if (stream->mBlocks[streamBlockIndex] >= 0) {
// We no longer want to own this block
int32_t globalBlockIndex = stream->mBlocks[streamBlockIndex];
- CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
+ CACHE_LOG(LogLevel::Debug, ("Released block %d from stream %p block %d(%lld)",
globalBlockIndex, stream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
RemoveBlockOwner(globalBlockIndex, stream);
}
}
// Extend the mBlocks array as necessary
TimeStamp now = TimeStamp::Now();
int32_t blockIndex = FindBlockForIncomingData(now, aStream);
if (blockIndex >= 0) {
FreeBlock(blockIndex);
Block* block = &mIndex[blockIndex];
- CACHE_LOG(PR_LOG_DEBUG, ("Allocated block %d to stream %p block %d(%lld)",
+ CACHE_LOG(LogLevel::Debug, ("Allocated block %d to stream %p block %d(%lld)",
blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
mFreeBlocks.RemoveBlock(blockIndex);
// Tell each stream using this resource about the new block.
ResourceStreamIterator iter(aStream->mResourceID);
while (MediaCacheStream* stream = iter.Next()) {
BlockOwner* bo = block->mOwners.AppendElement();
@@ -1541,48 +1541,48 @@ MediaCache::AllocateAndWriteBlock(MediaC
// the block in the list.
bo->mClass = READAHEAD_BLOCK;
InsertReadaheadBlock(bo, blockIndex);
}
}
nsresult rv = mFileCache->WriteBlock(blockIndex, reinterpret_cast<const uint8_t*>(aData));
if (NS_FAILED(rv)) {
- CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
+ CACHE_LOG(LogLevel::Debug, ("Released block %d from stream %p block %d(%lld)",
blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE));
FreeBlock(blockIndex);
}
}
// Queue an Update since the cache state has changed (for example
// we might want to stop loading because the cache is full)
QueueUpdate();
}
void
MediaCache::OpenStream(MediaCacheStream* aStream)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p opened", aStream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p opened", aStream));
mStreams.AppendElement(aStream);
aStream->mResourceID = AllocateResourceID();
// Queue an update since a new stream has been opened.
gMediaCache->QueueUpdate();
}
void
MediaCache::ReleaseStream(MediaCacheStream* aStream)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p closed", aStream));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p closed", aStream));
mStreams.RemoveElement(aStream);
// Update MediaCache again for |mStreams| is changed.
// We need to re-run Update() to ensure streams reading from the same resource
// as the removed stream get a chance to continue reading.
gMediaCache->QueueUpdate();
}
@@ -1593,17 +1593,17 @@ MediaCache::ReleaseStreamBlocks(MediaCac
// XXX scanning the entire stream doesn't seem great, if not much of it
// is cached, but the only easy alternative is to scan the entire cache
// which isn't better
uint32_t length = aStream->mBlocks.Length();
for (uint32_t i = 0; i < length; ++i) {
int32_t blockIndex = aStream->mBlocks[i];
if (blockIndex >= 0) {
- CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)",
+ CACHE_LOG(LogLevel::Debug, ("Released block %d from stream %p block %d(%lld)",
blockIndex, aStream, i, (long long)i*BLOCK_SIZE));
RemoveBlockOwner(blockIndex, aStream);
}
}
}
void
MediaCache::Truncate()
@@ -1764,17 +1764,17 @@ MediaCacheStream::NotifyDataReceived(int
}
}
}
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
int64_t size = aSize;
const char* data = aData;
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p DataReceived at %lld count=%lld",
+ CACHE_LOG(LogLevel::Debug, ("Stream %p DataReceived at %lld count=%lld",
this, (long long)mChannelOffset, (long long)aSize));
// We process the data one block (or part of a block) at a time
while (size > 0) {
uint32_t blockIndex = mChannelOffset/BLOCK_SIZE;
int32_t blockOffset = int32_t(mChannelOffset - blockIndex*BLOCK_SIZE);
int32_t chunkSize = std::min<int64_t>(BLOCK_SIZE - blockOffset, size);
@@ -1832,17 +1832,17 @@ void
MediaCacheStream::FlushPartialBlockInternal(bool aNotifyAll)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
int32_t blockOffset = int32_t(mChannelOffset%BLOCK_SIZE);
if (blockOffset > 0) {
- CACHE_LOG(PR_LOG_DEBUG,
+ CACHE_LOG(LogLevel::Debug,
("Stream %p writing partial block: [%d] bytes; "
"mStreamOffset [%lld] mChannelOffset[%lld] mStreamLength [%lld] "
"notifying: [%s]",
this, blockOffset, mStreamOffset, mChannelOffset, mStreamLength,
aNotifyAll ? "yes" : "no"));
// Write back the partial block
memset(reinterpret_cast<char*>(mPartialBlockBuffer.get()) + blockOffset, 0,
@@ -2181,17 +2181,17 @@ MediaCacheStream::Seek(int32_t aWhence,
NS_ERROR("Unknown whence");
return NS_ERROR_FAILURE;
}
if (newOffset < 0)
return NS_ERROR_FAILURE;
mStreamOffset = newOffset;
- CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Seek to %lld", this, (long long)mStreamOffset));
+ CACHE_LOG(LogLevel::Debug, ("Stream %p Seek to %lld", this, (long long)mStreamOffset));
gMediaCache->NoteSeek(this, oldOffset);
gMediaCache->QueueUpdate();
return NS_OK;
}
int64_t
MediaCacheStream::Tell()
@@ -2298,17 +2298,17 @@ MediaCacheStream::Read(char* aBuffer, ui
count += bytes;
}
if (count > 0) {
// Some data was read, so queue an update since block priorities may
// have changed
gMediaCache->QueueUpdate();
}
- CACHE_LOG(PR_LOG_DEBUG,
+ CACHE_LOG(LogLevel::Debug,
("Stream %p Read at %lld count=%d", this, (long long)(mStreamOffset-count), count));
*aBytes = count;
return NS_OK;
}
nsresult
MediaCacheStream::ReadAt(int64_t aOffset, char* aBuffer,
uint32_t aCount, uint32_t* aBytes)
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -48,17 +48,17 @@ namespace mozilla {
// fluctuating bitrates.
static const int64_t CAN_PLAY_THROUGH_MARGIN = 1;
// avoid redefined macro in unified build
#undef DECODER_LOG
PRLogModuleInfo* gMediaDecoderLog;
#define DECODER_LOG(x, ...) \
- MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, this, ##__VA_ARGS__))
+ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, this, ##__VA_ARGS__))
static const char* const gPlayStateStr[] = {
"START",
"LOADING",
"PAUSED",
"PLAYING",
"SEEKING",
"ENDED",
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -17,17 +17,17 @@
namespace mozilla {
// Un-comment to enable logging of seek bisections.
//#define SEEK_LOGGING
extern PRLogModuleInfo* gMediaDecoderLog;
#define DECODER_LOG(x, ...) \
- MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__))
+ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__))
// Same workaround as MediaDecoderStateMachine.cpp.
#define DECODER_WARN_HELPER(a, b) NS_WARNING b
#define DECODER_WARN(x, ...) \
DECODER_WARN_HELPER(0, (nsPrintfCString("Decoder=%p " x, mDecoder, ##__VA_ARGS__).get()))
class VideoQueueMemoryFunctor : public nsDequeFunctor {
public:
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -55,21 +55,21 @@ using namespace mozilla::gfx;
#undef DECODER_LOG
#undef VERBOSE_LOG
extern PRLogModuleInfo* gMediaDecoderLog;
extern PRLogModuleInfo* gMediaSampleLog;
#define LOG(m, l, x, ...) \
MOZ_LOG(m, l, ("Decoder=%p " x, mDecoder.get(), ##__VA_ARGS__))
#define DECODER_LOG(x, ...) \
- LOG(gMediaDecoderLog, PR_LOG_DEBUG, x, ##__VA_ARGS__)
+ LOG(gMediaDecoderLog, LogLevel::Debug, x, ##__VA_ARGS__)
#define VERBOSE_LOG(x, ...) \
- LOG(gMediaDecoderLog, PR_LOG_VERBOSE, x, ##__VA_ARGS__)
+ LOG(gMediaDecoderLog, LogLevel::Verbose, x, ##__VA_ARGS__)
#define SAMPLE_LOG(x, ...) \
- LOG(gMediaSampleLog, PR_LOG_DEBUG, x, ##__VA_ARGS__)
+ LOG(gMediaSampleLog, LogLevel::Debug, x, ##__VA_ARGS__)
// Somehow MSVC doesn't correctly delete the comma before ##__VA_ARGS__
// when __VA_ARGS__ expands to nothing. This is a workaround for it.
#define DECODER_WARN_HELPER(a, b) NS_WARNING b
#define DECODER_WARN(x, ...) \
DECODER_WARN_HELPER(0, (nsPrintfCString("Decoder=%p " x, mDecoder.get(), ##__VA_ARGS__).get()))
// Certain constants get stored as member variables and then adjusted by various
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -30,18 +30,18 @@ using mozilla::layers::LayersBackend;
PRLogModuleInfo* GetFormatDecoderLog() {
static PRLogModuleInfo* log = nullptr;
if (!log) {
log = PR_NewLogModule("MediaFormatReader");
}
return log;
}
-#define LOG(arg, ...) MOZ_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define LOGV(arg, ...) MOZ_LOG(GetFormatDecoderLog(), PR_LOG_VERBOSE, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define LOG(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define LOGV(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
namespace mozilla {
static const char*
TrackTypeToStr(TrackInfo::TrackType aTrack)
{
MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack ||
aTrack == TrackInfo::kVideoTrack ||
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -106,17 +106,17 @@ namespace mozilla {
PRLogModuleInfo*
GetMediaManagerLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("MediaManager");
return sLog;
}
-#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
+#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg)
using dom::File;
using dom::MediaStreamConstraints;
using dom::MediaTrackConstraintSet;
using dom::MediaTrackConstraints;
using dom::MediaStreamError;
using dom::GetUserMediaRequest;
using dom::Sequence;
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -44,17 +44,17 @@
namespace mozilla {
namespace dom {
struct MediaStreamConstraints;
struct MediaTrackConstraintSet;
}
extern PRLogModuleInfo* GetMediaManagerLog();
-#define MM_LOG(msg) MOZ_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
+#define MM_LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg)
/**
* This class is an implementation of MediaStreamListener. This is used
* to Start() and Stop() the underlying MediaEngineSource when MediaStreams
* are assigned and deassigned in content.
*/
class GetUserMediaCallbackMediaStreamListener : public MediaStreamListener
{
--- a/dom/media/MediaPromise.h
+++ b/dom/media/MediaPromise.h
@@ -26,17 +26,17 @@
#endif
namespace mozilla {
extern PRLogModuleInfo* gMediaPromiseLog;
#define PROMISE_LOG(x, ...) \
MOZ_ASSERT(gMediaPromiseLog); \
- MOZ_LOG(gMediaPromiseLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
+ MOZ_LOG(gMediaPromiseLog, mozilla::LogLevel::Debug, (x, ##__VA_ARGS__))
namespace detail {
template<typename ThisType, typename Ret, typename ArgType>
static TrueType TakesArgumentHelper(Ret (ThisType::*)(ArgType));
template<typename ThisType, typename Ret, typename ArgType>
static TrueType TakesArgumentHelper(Ret (ThisType::*)(ArgType) const);
template<typename ThisType, typename Ret>
static FalseType TakesArgumentHelper(Ret (ThisType::*)());
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -163,17 +163,17 @@ class MediaRecorder::Session: public nsI
{
public:
explicit PushBlobRunnable(Session* aSession)
: mSession(aSession)
{ }
NS_IMETHODIMP Run()
{
- LOG(PR_LOG_DEBUG, ("Session.PushBlobRunnable s=(%p)", mSession.get()));
+ LOG(LogLevel::Debug, ("Session.PushBlobRunnable s=(%p)", mSession.get()));
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<MediaRecorder> recorder = mSession->mRecorder;
if (!recorder) {
return NS_OK;
}
nsresult rv = recorder->CreateAndDispatchBlobEvent(mSession->GetEncodedData());
@@ -193,17 +193,17 @@ class MediaRecorder::Session: public nsI
{
public:
explicit EncoderErrorNotifierRunnable(Session* aSession)
: mSession(aSession)
{ }
NS_IMETHODIMP Run()
{
- LOG(PR_LOG_DEBUG, ("Session.ErrorNotifyRunnable s=(%p)", mSession.get()));
+ LOG(LogLevel::Debug, ("Session.ErrorNotifyRunnable s=(%p)", mSession.get()));
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<MediaRecorder> recorder = mSession->mRecorder;
if (!recorder) {
return NS_OK;
}
if (mSession->IsEncoderError()) {
@@ -222,17 +222,17 @@ class MediaRecorder::Session: public nsI
public:
DispatchStartEventRunnable(Session* aSession, const nsAString & aEventName)
: mSession(aSession)
, mEventName(aEventName)
{ }
NS_IMETHODIMP Run()
{
- LOG(PR_LOG_DEBUG, ("Session.DispatchStartEventRunnable s=(%p)", mSession.get()));
+ LOG(LogLevel::Debug, ("Session.DispatchStartEventRunnable s=(%p)", mSession.get()));
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE(mSession->mRecorder, NS_OK);
nsRefPtr<MediaRecorder> recorder = mSession->mRecorder;
recorder->SetMimeType(mSession->mMimeType);
recorder->DispatchSimpleEvent(mEventName);
@@ -254,17 +254,17 @@ class MediaRecorder::Session: public nsI
~ExtractRunnable()
{}
NS_IMETHODIMP Run()
{
MOZ_ASSERT(NS_GetCurrentThread() == mSession->mReadThread);
- LOG(PR_LOG_DEBUG, ("Session.ExtractRunnable shutdown = %d", mSession->mEncoder->IsShutdown()));
+ LOG(LogLevel::Debug, ("Session.ExtractRunnable shutdown = %d", mSession->mEncoder->IsShutdown()));
if (!mSession->mEncoder->IsShutdown()) {
mSession->Extract(false);
nsCOMPtr<nsIRunnable> event = new ExtractRunnable(mSession);
if (NS_FAILED(NS_DispatchToCurrentThread(event))) {
NS_WARNING("Failed to dispatch ExtractRunnable to encoder thread");
}
} else {
// Flush out remaining encoded data.
@@ -299,33 +299,33 @@ class MediaRecorder::Session: public nsI
}
nsTArray<nsRefPtr<mozilla::dom::VideoStreamTrack>> videoTracks;
aStream->GetVideoTracks(videoTracks);
if (!videoTracks.IsEmpty()) {
trackTypes |= ContainerWriter::CREATE_VIDEO_TRACK;
}
- LOG(PR_LOG_DEBUG, ("Session.NotifyTracksAvailable track type = (%d)", trackTypes));
+ LOG(LogLevel::Debug, ("Session.NotifyTracksAvailable track type = (%d)", trackTypes));
mSession->InitEncoder(trackTypes);
}
private:
nsRefPtr<Session> mSession;
};
// Main thread task.
// To delete RecordingSession object.
class DestroyRunnable : public nsRunnable
{
public:
explicit DestroyRunnable(Session* aSession)
: mSession(aSession) {}
NS_IMETHODIMP Run()
{
- LOG(PR_LOG_DEBUG, ("Session.DestroyRunnable session refcnt = (%d) stopIssued %d s=(%p)",
+ LOG(LogLevel::Debug, ("Session.DestroyRunnable session refcnt = (%d) stopIssued %d s=(%p)",
(int)mSession->mRefCnt, mSession->mStopIssued, mSession.get()));
MOZ_ASSERT(NS_IsMainThread() && mSession.get());
nsRefPtr<MediaRecorder> recorder = mSession->mRecorder;
if (!recorder) {
return NS_OK;
}
// SourceMediaStream is ended, and send out TRACK_EVENT_END notification.
// Read Thread will be terminate soon.
@@ -376,61 +376,61 @@ public:
uint32_t maxMem = Preferences::GetUint("media.recorder.max_memory",
MAX_ALLOW_MEMORY_BUFFER);
mEncodedBufferCache = new EncodedBufferCache(maxMem);
mLastBlobTimeStamp = TimeStamp::Now();
}
void Start()
{
- LOG(PR_LOG_DEBUG, ("Session.Start %p", this));
+ LOG(LogLevel::Debug, ("Session.Start %p", this));
MOZ_ASSERT(NS_IsMainThread());
SetupStreams();
}
void Stop()
{
- LOG(PR_LOG_DEBUG, ("Session.Stop %p", this));
+ LOG(LogLevel::Debug, ("Session.Stop %p", this));
MOZ_ASSERT(NS_IsMainThread());
mStopIssued = true;
CleanupStreams();
if (mNeedSessionEndTask) {
- LOG(PR_LOG_DEBUG, ("Session.Stop mNeedSessionEndTask %p", this));
+ LOG(LogLevel::Debug, ("Session.Stop mNeedSessionEndTask %p", this));
// End the Session directly if there is no ExtractRunnable.
DoSessionEndTask(NS_OK);
}
nsContentUtils::UnregisterShutdownObserver(this);
}
nsresult Pause()
{
- LOG(PR_LOG_DEBUG, ("Session.Pause"));
+ LOG(LogLevel::Debug, ("Session.Pause"));
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE(mTrackUnionStream, NS_ERROR_FAILURE);
mTrackUnionStream->ChangeExplicitBlockerCount(1);
return NS_OK;
}
nsresult Resume()
{
- LOG(PR_LOG_DEBUG, ("Session.Resume"));
+ LOG(LogLevel::Debug, ("Session.Resume"));
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE(mTrackUnionStream, NS_ERROR_FAILURE);
mTrackUnionStream->ChangeExplicitBlockerCount(-1);
return NS_OK;
}
nsresult RequestData()
{
- LOG(PR_LOG_DEBUG, ("Session.RequestData"));
+ LOG(LogLevel::Debug, ("Session.RequestData"));
MOZ_ASSERT(NS_IsMainThread());
if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this))) ||
NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) {
MOZ_ASSERT(false, "RequestData NS_DispatchToMainThread failed");
return NS_ERROR_FAILURE;
}
@@ -459,27 +459,27 @@ public:
return amount;
}
private:
// Only DestroyRunnable is allowed to delete Session object.
virtual ~Session()
{
- LOG(PR_LOG_DEBUG, ("Session.~Session (%p)", this));
+ LOG(LogLevel::Debug, ("Session.~Session (%p)", this));
CleanupStreams();
}
// Pull encoded media data from MediaEncoder and put into EncodedBufferCache.
// Destroy this session object in the end of this function.
// If the bool aForceFlush is true, we will force to dispatch a
// PushBlobRunnable to main thread.
void Extract(bool aForceFlush)
{
MOZ_ASSERT(NS_GetCurrentThread() == mReadThread);
- LOG(PR_LOG_DEBUG, ("Session.Extract %p", this));
+ LOG(LogLevel::Debug, ("Session.Extract %p", this));
if (!mIsRegisterProfiler) {
char aLocal;
profiler_register_thread("Media_Encoder", &aLocal);
mIsRegisterProfiler = true;
}
PROFILER_LABEL("MediaRecorder", "Session Extract",
@@ -572,66 +572,66 @@ private:
uint32_t perm = nsIPermissionManager::DENY_ACTION;
pm->TestExactPermissionFromPrincipal(doc->NodePrincipal(), "audio-capture:3gpp", &perm);
return perm == nsIPermissionManager::ALLOW_ACTION;
}
void InitEncoder(uint8_t aTrackTypes)
{
- LOG(PR_LOG_DEBUG, ("Session.InitEncoder %p", this));
+ LOG(LogLevel::Debug, ("Session.InitEncoder %p", this));
MOZ_ASSERT(NS_IsMainThread());
if (!mRecorder) {
- LOG(PR_LOG_DEBUG, ("Session.InitEncoder failure, mRecorder is null %p", this));
+ LOG(LogLevel::Debug, ("Session.InitEncoder failure, mRecorder is null %p", this));
return;
}
// Allocate encoder and bind with union stream.
// At this stage, the API doesn't allow UA to choose the output mimeType format.
// Make sure the application has permission to assign AUDIO_3GPP
if (mRecorder->mMimeType.EqualsLiteral(AUDIO_3GPP) && Check3gppPermission()) {
mEncoder = MediaEncoder::CreateEncoder(NS_LITERAL_STRING(AUDIO_3GPP), aTrackTypes);
} else {
mEncoder = MediaEncoder::CreateEncoder(NS_LITERAL_STRING(""), aTrackTypes);
}
if (!mEncoder) {
- LOG(PR_LOG_DEBUG, ("Session.InitEncoder !mEncoder %p", this));
+ LOG(LogLevel::Debug, ("Session.InitEncoder !mEncoder %p", this));
DoSessionEndTask(NS_ERROR_ABORT);
return;
}
// Media stream is ready but UA issues a stop method follow by start method.
// The Session::stop would clean the mTrackUnionStream. If the AfterTracksAdded
// comes after stop command, this function would crash.
if (!mTrackUnionStream) {
- LOG(PR_LOG_DEBUG, ("Session.InitEncoder !mTrackUnionStream %p", this));
+ LOG(LogLevel::Debug, ("Session.InitEncoder !mTrackUnionStream %p", this));
DoSessionEndTask(NS_OK);
return;
}
mTrackUnionStream->AddListener(mEncoder);
// Create a thread to read encode media data from MediaEncoder.
if (!mReadThread) {
nsresult rv = NS_NewNamedThread("Media_Encoder", getter_AddRefs(mReadThread));
if (NS_FAILED(rv)) {
- LOG(PR_LOG_DEBUG, ("Session.InitEncoder !mReadThread %p", this));
+ LOG(LogLevel::Debug, ("Session.InitEncoder !mReadThread %p", this));
DoSessionEndTask(rv);
return;
}
}
// In case source media stream does not notify track end, receive
// shutdown notification and stop Read Thread.
nsContentUtils::RegisterShutdownObserver(this);
nsCOMPtr<nsIRunnable> event = new ExtractRunnable(this);
if (NS_FAILED(mReadThread->Dispatch(event, NS_DISPATCH_NORMAL))) {
NS_WARNING("Failed to dispatch ExtractRunnable at beginning");
- LOG(PR_LOG_DEBUG, ("Session.InitEncoder !ReadThread->Dispatch %p", this));
+ LOG(LogLevel::Debug, ("Session.InitEncoder !ReadThread->Dispatch %p", this));
DoSessionEndTask(NS_ERROR_ABORT);
}
// Set mNeedSessionEndTask to false because the
// ExtractRunnable/DestroyRunnable will take the response to
// end the session.
mNeedSessionEndTask = false;
}
// application should get blob and onstop event
@@ -667,17 +667,17 @@ private:
mTrackUnionStream->Destroy();
mTrackUnionStream = nullptr;
}
}
NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) override
{
MOZ_ASSERT(NS_IsMainThread());
- LOG(PR_LOG_DEBUG, ("Session.Observe XPCOM_SHUTDOWN %p", this));
+ LOG(LogLevel::Debug, ("Session.Observe XPCOM_SHUTDOWN %p", this));
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
// Force stop Session to terminate Read Thread.
mEncoder->Cancel();
if (mReadThread) {
mReadThread->Shutdown();
mReadThread = nullptr;
}
BreakCycle();
@@ -737,17 +737,17 @@ private:
NS_IMPL_ISUPPORTS(MediaRecorder::Session, nsIObserver)
MediaRecorder::~MediaRecorder()
{
if (mPipeStream != nullptr) {
mInputPort->Destroy();
mPipeStream->Destroy();
}
- LOG(PR_LOG_DEBUG, ("~MediaRecorder (%p)", this));
+ LOG(LogLevel::Debug, ("~MediaRecorder (%p)", this));
UnRegisterActivityObserver();
}
MediaRecorder::MediaRecorder(DOMMediaStream& aSourceMediaStream,
nsPIDOMWindow* aOwnerWindow)
: DOMEventTargetHelper(aOwnerWindow)
, mState(RecordingState::Inactive)
{
@@ -827,17 +827,17 @@ void
MediaRecorder::GetMimeType(nsString &aMimeType)
{
aMimeType = mMimeType;
}
void
MediaRecorder::Start(const Optional<int32_t>& aTimeSlice, ErrorResult& aResult)
{
- LOG(PR_LOG_DEBUG, ("MediaRecorder.Start %p", this));
+ LOG(LogLevel::Debug, ("MediaRecorder.Start %p", this));
if (mState != RecordingState::Inactive) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
if (GetSourceMediaStream()->IsFinished() || GetSourceMediaStream()->IsDestroyed()) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
@@ -869,31 +869,31 @@ MediaRecorder::Start(const Optional<int3
mSessions.AppendElement();
mSessions.LastElement() = new Session(this, timeSlice);
mSessions.LastElement()->Start();
}
void
MediaRecorder::Stop(ErrorResult& aResult)
{
- LOG(PR_LOG_DEBUG, ("MediaRecorder.Stop %p", this));
+ LOG(LogLevel::Debug, ("MediaRecorder.Stop %p", this));
MediaRecorderReporter::RemoveMediaRecorder(this);
if (mState == RecordingState::Inactive) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
mState = RecordingState::Inactive;
MOZ_ASSERT(mSessions.Length() > 0);
mSessions.LastElement()->Stop();
}
void
MediaRecorder::Pause(ErrorResult& aResult)
{
- LOG(PR_LOG_DEBUG, ("MediaRecorder.Pause"));
+ LOG(LogLevel::Debug, ("MediaRecorder.Pause"));
if (mState != RecordingState::Recording) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
MOZ_ASSERT(mSessions.Length() > 0);
nsresult rv = mSessions.LastElement()->Pause();
if (NS_FAILED(rv)) {
@@ -901,17 +901,17 @@ MediaRecorder::Pause(ErrorResult& aResul
return;
}
mState = RecordingState::Paused;
}
void
MediaRecorder::Resume(ErrorResult& aResult)
{
- LOG(PR_LOG_DEBUG, ("MediaRecorder.Resume"));
+ LOG(LogLevel::Debug, ("MediaRecorder.Resume"));
if (mState != RecordingState::Paused) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
MOZ_ASSERT(mSessions.Length() > 0);
nsresult rv = mSessions.LastElement()->Resume();
if (NS_FAILED(rv)) {
@@ -1107,29 +1107,29 @@ bool MediaRecorder::CheckPrincipal()
return false;
}
return subsumes;
}
void
MediaRecorder::RemoveSession(Session* aSession)
{
- LOG(PR_LOG_DEBUG, ("MediaRecorder.RemoveSession (%p)", aSession));
+ LOG(LogLevel::Debug, ("MediaRecorder.RemoveSession (%p)", aSession));
mSessions.RemoveElement(aSession);
}
void
MediaRecorder::NotifyOwnerDocumentActivityChanged()
{
nsPIDOMWindow* window = GetOwner();
NS_ENSURE_TRUE_VOID(window);
nsIDocument* doc = window->GetExtantDoc();
NS_ENSURE_TRUE_VOID(doc);
- LOG(PR_LOG_DEBUG, ("MediaRecorder %p document IsActive %d isVisible %d\n",
+ LOG(LogLevel::Debug, ("MediaRecorder %p document IsActive %d isVisible %d\n",
this, doc->IsActive(), doc->IsVisible()));
if (!doc->IsActive() || !doc->IsVisible()) {
// Stop the session.
ErrorResult result;
Stop(result);
}
}
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -29,17 +29,17 @@
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsContentUtils.h"
#include "nsHostObjectProtocolHandler.h"
#include <algorithm>
#include "nsProxyRelease.h"
#include "nsIContentPolicy.h"
PRLogModuleInfo* gMediaResourceLog;
-#define RESOURCE_LOG(msg, ...) MOZ_LOG(gMediaResourceLog, PR_LOG_DEBUG, \
+#define RESOURCE_LOG(msg, ...) MOZ_LOG(gMediaResourceLog, mozilla::LogLevel::Debug, \
(msg, ##__VA_ARGS__))
// Debug logging macro with object pointer and class name.
#define CMLOG(msg, ...) \
RESOURCE_LOG("%p [ChannelMediaResource]: " msg, this, ##__VA_ARGS__)
static const uint32_t HTTP_OK_CODE = 200;
static const uint32_t HTTP_PARTIAL_RESPONSE_CODE = 206;
--- a/dom/media/MediaShutdownManager.cpp
+++ b/dom/media/MediaShutdownManager.cpp
@@ -108,17 +108,17 @@ ShutdownMediaDecoder(nsRefPtrHashKey<Med
}
void
MediaShutdownManager::Shutdown()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(sInstance);
- DECODER_LOG(PR_LOG_DEBUG, ("MediaShutdownManager::Shutdown() start..."));
+ DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::Shutdown() start..."));
// Mark that we're shutting down, so that Unregister(*) calls don't remove
// hashtable entries. If Unregsiter(*) was to remove from the hash table,
// the iterations over the hashtables below would be disrupted.
mIsDoingXPCOMShutDown = true;
// Iterate over the decoders and shut them down, and remove them from the
// hashtable.
@@ -134,12 +134,12 @@ MediaShutdownManager::Shutdown()
nsContentUtils::UnregisterShutdownObserver(this);
// Clear the singleton instance. The only remaining reference should be the
// reference that the observer service used to call us with. The
// MediaShutdownManager will be deleted once the observer service cleans
// up after it finishes its notifications.
sInstance = nullptr;
- DECODER_LOG(PR_LOG_DEBUG, ("MediaShutdownManager::Shutdown() end."));
+ DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::Shutdown() end."));
}
} // namespace mozilla
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -63,17 +63,17 @@ PRLogModuleInfo* gMediaStreamGraphLog;
* The singleton graph instance.
*/
static nsDataHashtable<nsUint32HashKey, MediaStreamGraphImpl*> gGraphs;
MediaStreamGraphImpl::~MediaStreamGraphImpl()
{
NS_ASSERTION(IsEmpty(),
"All streams should have been destroyed by messages from the main thread");
- STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this));
+ STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p destroyed", this));
LIFECYCLE_LOG("MediaStreamGraphImpl::~MediaStreamGraphImpl\n");
}
StreamTime
MediaStreamGraphImpl::GetDesiredBufferEnd(MediaStream* aStream)
{
StreamTime current = IterationEnd() - aStream->mBufferStartTime;
@@ -83,17 +83,17 @@ MediaStreamGraphImpl::GetDesiredBufferEn
2 * MillisecondsToMediaTime(std::max(AUDIO_TARGET_MS, VIDEO_TARGET_MS));
}
void
MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
{
if (aStream->mFinished)
return;
- STREAM_LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream));
+ STREAM_LOG(LogLevel::Debug, ("MediaStream %p will finish", aStream));
aStream->mFinished = true;
aStream->mBuffer.AdvanceKnownTracksTime(STREAM_TIME_MAX);
// Force at least one more iteration of the control loop, since we rely
// on UpdateCurrentTimeForStreams to notify our listeners once the stream end
// has been reached.
EnsureNextIteration();
SetStreamOrderDirty();
@@ -113,21 +113,21 @@ MediaStreamGraphImpl::AddStream(MediaStr
contextSuspended = true;
}
}
}
if (contextSuspended) {
aStream->mBufferStartTime = START_TIME_DELAYED;
mSuspendedStreams.AppendElement(aStream);
- STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph, in the suspended stream array", aStream));
+ STREAM_LOG(LogLevel::Debug, ("Adding media stream %p to the graph, in the suspended stream array", aStream));
} else {
aStream->mBufferStartTime = IterationEnd();
mStreams.AppendElement(aStream);
- STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph", aStream));
+ STREAM_LOG(LogLevel::Debug, ("Adding media stream %p to the graph", aStream));
}
SetStreamOrderDirty();
}
void
MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
{
@@ -146,17 +146,17 @@ MediaStreamGraphImpl::RemoveStream(Media
// Ensure that mFirstCycleBreaker and mMixer are updated when necessary.
SetStreamOrderDirty();
mStreams.RemoveElement(aStream);
mSuspendedStreams.RemoveElement(aStream);
NS_RELEASE(aStream); // probably destroying it
- STREAM_LOG(PR_LOG_DEBUG, ("Removing media stream %p from the graph", aStream));
+ STREAM_LOG(LogLevel::Debug, ("Removing media stream %p from the graph", aStream));
}
void
MediaStreamGraphImpl::UpdateConsumptionState(SourceMediaStream* aStream)
{
MediaStreamListener::Consumption state =
aStream->mIsConsumed ? MediaStreamListener::CONSUMED
: MediaStreamListener::NOT_CONSUMED;
@@ -180,24 +180,24 @@ MediaStreamGraphImpl::ExtractPendingInpu
if (aStream->mPullEnabled && !aStream->mFinished &&
!aStream->mListeners.IsEmpty()) {
// Compute how much stream time we'll need assuming we don't block
// the stream at all between mBlockingDecisionsMadeUntilTime and
// aDesiredUpToTime.
StreamTime t =
GraphTimeToStreamTime(aStream, CurrentDriver()->StateComputedTime()) +
(aDesiredUpToTime - CurrentDriver()->StateComputedTime());
- STREAM_LOG(PR_LOG_VERBOSE, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream,
+ STREAM_LOG(LogLevel::Verbose, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream,
MediaTimeToSeconds(t),
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
if (t > aStream->mBuffer.GetEnd()) {
*aEnsureNextIteration = true;
#ifdef DEBUG
if (aStream->mListeners.Length() == 0) {
- STREAM_LOG(PR_LOG_ERROR, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f",
+ STREAM_LOG(LogLevel::Error, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f",
aStream, MediaTimeToSeconds(t),
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
aStream->DumpTrackInfo();
}
#endif
for (uint32_t j = 0; j < aStream->mListeners.Length(); ++j) {
MediaStreamListener* l = aStream->mListeners[j];
{
@@ -215,30 +215,30 @@ MediaStreamGraphImpl::ExtractPendingInpu
for (MediaStreamListener* l : aStream->mListeners) {
StreamTime offset = (data->mCommands & SourceMediaStream::TRACK_CREATE)
? data->mStart : aStream->mBuffer.FindTrack(data->mID)->GetSegment()->GetDuration();
l->NotifyQueuedTrackChanges(this, data->mID,
offset, data->mCommands, *data->mData);
}
if (data->mCommands & SourceMediaStream::TRACK_CREATE) {
MediaSegment* segment = data->mData.forget();
- STREAM_LOG(PR_LOG_DEBUG, ("SourceMediaStream %p creating track %d, start %lld, initial end %lld",
+ STREAM_LOG(LogLevel::Debug, ("SourceMediaStream %p creating track %d, start %lld, initial end %lld",
aStream, data->mID, int64_t(data->mStart),
int64_t(segment->GetDuration())));
data->mEndOfFlushedData += segment->GetDuration();
aStream->mBuffer.AddTrack(data->mID, data->mStart, segment);
// The track has taken ownership of data->mData, so let's replace
// data->mData with an empty clone.
data->mData = segment->CreateEmptyClone();
data->mCommands &= ~SourceMediaStream::TRACK_CREATE;
notifiedTrackCreated = true;
} else if (data->mData->GetDuration() > 0) {
MediaSegment* dest = aStream->mBuffer.FindTrack(data->mID)->GetSegment();
- STREAM_LOG(PR_LOG_VERBOSE, ("SourceMediaStream %p track %d, advancing end from %lld to %lld",
+ STREAM_LOG(LogLevel::Verbose, ("SourceMediaStream %p track %d, advancing end from %lld to %lld",
aStream, data->mID,
int64_t(dest->GetDuration()),
int64_t(dest->GetDuration() + data->mData->GetDuration())));
data->mEndOfFlushedData += data->mData->GetDuration();
dest->AppendFrom(data->mData);
}
if (data->mCommands & SourceMediaStream::TRACK_END) {
aStream->mBuffer.FindTrack(data->mID)->SetEnded();
@@ -477,17 +477,17 @@ MediaStreamGraphImpl::UpdateCurrentTimeF
if (streamHasOutput) {
StreamNotifyOutput(stream);
}
if (stream->mFinished && !stream->mNotifiedFinished) {
StreamReadyToFinish(stream);
}
}
- STREAM_LOG(PR_LOG_VERBOSE,
+ STREAM_LOG(LogLevel::Verbose,
("MediaStream %p bufferStartTime=%f blockedTime=%f", stream,
MediaTimeToSeconds(stream->mBufferStartTime),
MediaTimeToSeconds(blockedTime)));
}
}
}
bool
@@ -500,38 +500,38 @@ MediaStreamGraphImpl::WillUnderrun(Media
if (aStream->mFinished || aStream->AsProcessedStream()) {
return false;
}
GraphTime bufferEnd =
StreamTimeToGraphTime(aStream, aStream->GetBufferEnd(),
INCLUDE_TRAILING_BLOCKED_INTERVAL);
#ifdef DEBUG
if (bufferEnd < IterationEnd()) {
- STREAM_LOG(PR_LOG_ERROR, ("MediaStream %p underrun, "
+ STREAM_LOG(LogLevel::Error, ("MediaStream %p underrun, "
"bufferEnd %f < IterationEnd() %f (%lld < %lld), Streamtime %lld",
aStream, MediaTimeToSeconds(bufferEnd), MediaTimeToSeconds(IterationEnd()),
bufferEnd, IterationEnd(), aStream->GetBufferEnd()));
aStream->DumpTrackInfo();
NS_ASSERTION(bufferEnd >= IterationEnd(), "Buffer underran");
}
#endif
// We should block after bufferEnd.
if (bufferEnd <= aTime) {
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p will block due to data underrun at %ld, "
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p will block due to data underrun at %ld, "
"bufferEnd %ld",
aStream, aTime, bufferEnd));
return true;
}
// We should keep blocking if we're currently blocked and we don't have
// data all the way through to aEndBlockingDecisions. If we don't have
// data all the way through to aEndBlockingDecisions, we'll block soon,
// but we might as well remain unblocked and play the data we've got while
// we can.
if (bufferEnd < aEndBlockingDecisions && aStream->mBlocked.GetBefore(aTime)) {
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p will block due to speculative data underrun, "
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p will block due to speculative data underrun, "
"bufferEnd %f (end at %ld)",
aStream, MediaTimeToSeconds(bufferEnd), bufferEnd));
return true;
}
// Reconsider decisions at bufferEnd
*aEnd = std::min(*aEnd, bufferEnd);
return false;
}
@@ -808,17 +808,17 @@ MediaStreamGraphImpl::UpdateStreamOrder(
MOZ_ASSERT(orderedStreamCount == mFirstCycleBreaker);
}
void
MediaStreamGraphImpl::RecomputeBlocking(GraphTime aEndBlockingDecisions)
{
bool blockingDecisionsWillChange = false;
- STREAM_LOG(PR_LOG_VERBOSE, ("Media graph %p computing blocking for time %f",
+ STREAM_LOG(LogLevel::Verbose, ("Media graph %p computing blocking for time %f",
this, MediaTimeToSeconds(CurrentDriver()->StateComputedTime())));
nsTArray<MediaStream*>* runningAndSuspendedPair[2];
runningAndSuspendedPair[0] = &mStreams;
runningAndSuspendedPair[1] = &mSuspendedStreams;
for (uint32_t array = 0; array < 2; array++) {
for (uint32_t i = 0; i < (*runningAndSuspendedPair[array]).Length(); ++i) {
MediaStream* stream = (*runningAndSuspendedPair[array])[i];
@@ -842,17 +842,17 @@ MediaStreamGraphImpl::RecomputeBlocking(
GraphTime end;
stream->mBlocked.GetAt(IterationEnd(), &end);
if (end < GRAPH_TIME_MAX) {
blockingDecisionsWillChange = true;
}
}
}
- STREAM_LOG(PR_LOG_VERBOSE, ("Media graph %p computed blocking for interval %f to %f",
+ STREAM_LOG(LogLevel::Verbose, ("Media graph %p computed blocking for interval %f to %f",
this, MediaTimeToSeconds(CurrentDriver()->StateComputedTime()),
MediaTimeToSeconds(aEndBlockingDecisions)));
CurrentDriver()->UpdateStateComputedTime(aEndBlockingDecisions);
if (blockingDecisionsWillChange) {
// Make sure we wake up to notify listeners about these changes.
EnsureNextIteration();
@@ -920,34 +920,34 @@ MediaStreamGraphImpl::RecomputeBlockingA
for (uint32_t i = 0; i < aStreams.Length(); ++i) {
MediaStream* stream = aStreams[i];
if (stream->mFinished) {
GraphTime endTime = StreamTimeToGraphTime(stream,
stream->GetStreamBuffer().GetAllTracksEnd());
if (endTime <= aTime) {
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p is blocked due to being finished", stream));
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to being finished", stream));
// We'll block indefinitely
MarkStreamBlocking(stream);
*aEnd = std::min(*aEnd, aEndBlockingDecisions);
continue;
} else {
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)",
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)",
stream, MediaTimeToSeconds(stream->GetBufferEnd()),
MediaTimeToSeconds(endTime)));
*aEnd = std::min(*aEnd, endTime);
}
}
GraphTime end;
bool explicitBlock = stream->mExplicitBlockerCount.GetAt(aTime, &end) > 0;
*aEnd = std::min(*aEnd, end);
if (explicitBlock) {
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p is blocked due to explicit blocker", stream));
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to explicit blocker", stream));
MarkStreamBlocking(stream);
continue;
}
bool underrun = WillUnderrun(stream, aTime, aEndBlockingDecisions, aEnd);
if (underrun) {
// We'll block indefinitely
MarkStreamBlocking(stream);
@@ -1086,51 +1086,51 @@ MediaStreamGraphImpl::PlayAudio(MediaStr
} else {
toWrite = end - t;
}
ticksNeeded -= toWrite;
if (blocked) {
output.InsertNullDataAtStart(toWrite);
ticksWritten += toWrite;
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p writing %ld blocking-silence samples for %f to %f (%ld to %ld)\n",
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing %ld blocking-silence samples for %f to %f (%ld to %ld)\n",
aStream, toWrite, MediaTimeToSeconds(t), MediaTimeToSeconds(end),
offset, offset + toWrite));
} else {
StreamTime endTicksNeeded = offset + toWrite;
StreamTime endTicksAvailable = audio->GetDuration();
if (endTicksNeeded <= endTicksAvailable) {
- STREAM_LOG(PR_LOG_VERBOSE,
+ STREAM_LOG(LogLevel::Verbose,
("MediaStream %p writing %ld samples for %f to %f "
"(samples %ld to %ld)\n",
aStream, toWrite, MediaTimeToSeconds(t),
MediaTimeToSeconds(end), offset, endTicksNeeded));
output.AppendSlice(*audio, offset, endTicksNeeded);
ticksWritten += toWrite;
offset = endTicksNeeded;
} else {
// MOZ_ASSERT(track->IsEnded(), "Not enough data, and track not ended.");
// If we are at the end of the track, maybe write the remaining
// samples, and pad with/output silence.
if (endTicksNeeded > endTicksAvailable &&
offset < endTicksAvailable) {
output.AppendSlice(*audio, offset, endTicksAvailable);
- STREAM_LOG(PR_LOG_VERBOSE,
+ STREAM_LOG(LogLevel::Verbose,
("MediaStream %p writing %ld samples for %f to %f "
"(samples %ld to %ld)\n",
aStream, toWrite, MediaTimeToSeconds(t),
MediaTimeToSeconds(end), offset, endTicksNeeded));
uint32_t available = endTicksAvailable - offset;
ticksWritten += available;
toWrite -= available;
offset = endTicksAvailable;
}
output.AppendNullData(toWrite);
- STREAM_LOG(PR_LOG_VERBOSE,
+ STREAM_LOG(LogLevel::Verbose,
("MediaStream %p writing %ld padding slsamples for %f to "
"%f (samples %ld to %ld)\n",
aStream, toWrite, MediaTimeToSeconds(t),
MediaTimeToSeconds(end), offset, endTicksNeeded));
ticksWritten += toWrite;
}
output.ApplyVolume(volume);
}
@@ -1209,17 +1209,17 @@ MediaStreamGraphImpl::PlayVideo(MediaStr
if (thisFrame && thisFrame->GetImage()) {
start = thisStart;
frame = thisFrame;
}
}
if (!frame || *frame == aStream->mLastPlayedVideoFrame)
return;
- STREAM_LOG(PR_LOG_VERBOSE, ("MediaStream %p writing video frame %p (%dx%d)",
+ STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing video frame %p (%dx%d)",
aStream, frame->GetImage(), frame->GetIntrinsicSize().width,
frame->GetIntrinsicSize().height));
GraphTime startTime = StreamTimeToGraphTime(aStream,
start, INCLUDE_TRAILING_BLOCKED_INTERVAL);
TimeStamp targetTime = CurrentDriver()->GetCurrentTimeStamp() +
TimeDuration::FromMilliseconds(double(startTime - IterationEnd()));
for (uint32_t i = 0; i < aStream->mVideoOutputs.Length(); ++i) {
VideoFrameContainer* output = aStream->mVideoOutputs[i];
@@ -1516,17 +1516,17 @@ MediaStreamGraphImpl::OneIteration(Graph
MonitorAutoLock lock(mMonitor);
bool finalUpdate = mForceShutDown ||
(IterationEnd() >= mEndTime && AllFinishedStreamsNotified()) ||
(IsEmpty() && mBackMessageQueue.IsEmpty());
PrepareUpdatesToMainThreadState(finalUpdate);
if (finalUpdate) {
// Enter shutdown mode. The stable-state handler will detect this
// and complete shutdown. Destroy any streams immediately.
- STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p waiting for main thread cleanup", this));
+ STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p waiting for main thread cleanup", this));
// We'll shut down this graph object if it does not get restarted.
mLifecycleState = LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP;
// No need to Destroy streams here. The main-thread owner of each
// stream is responsible for calling Destroy on them.
return false;
}
CurrentDriver()->WaitForNextIteration();
@@ -1557,17 +1557,17 @@ MediaStreamGraphImpl::ApplyStreamUpdate(
stream->NotifyMainThreadListeners();
}
}
void
MediaStreamGraphImpl::ForceShutDown()
{
NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
- STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p ForceShutdown", this));
+ STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p ForceShutdown", this));
{
MonitorAutoLock lock(mMonitor);
mForceShutDown = true;
EnsureNextIterationLocked();
}
}
namespace {
@@ -2762,17 +2762,17 @@ SourceMediaStream::NeedsMixing()
{
MutexAutoLock lock(mMutex);
return mNeedsMixing;
}
void
MediaInputPort::Init()
{
- STREAM_LOG(PR_LOG_DEBUG, ("Adding MediaInputPort %p (from %p to %p) to the graph",
+ STREAM_LOG(LogLevel::Debug, ("Adding MediaInputPort %p (from %p to %p) to the graph",
this, mSource, mDest));
mSource->AddConsumer(this);
mDest->AddInput(this);
// mPortCount decremented via MediaInputPort::Destroy's message
++mDest->GraphImpl()->mPortCount;
}
void
@@ -3040,30 +3040,30 @@ MediaStreamGraph::GetInstance(bool aStar
nsContentUtils::RegisterShutdownObserver(new MediaStreamGraphShutdownObserver());
}
CubebUtils::InitPreferredSampleRate();
graph = new MediaStreamGraphImpl(true, CubebUtils::PreferredSampleRate(), aStartWithAudioDriver, aChannel);
gGraphs.Put(channel, graph);
- STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", graph));
+ STREAM_LOG(LogLevel::Debug, ("Starting up MediaStreamGraph %p", graph));
}
return graph;
}
MediaStreamGraph*
MediaStreamGraph::CreateNonRealtimeInstance(TrackRate aSampleRate)
{
NS_ASSERTION(NS_IsMainThread(), "Main thread only");
MediaStreamGraphImpl* graph = new MediaStreamGraphImpl(false, aSampleRate);
- STREAM_LOG(PR_LOG_DEBUG, ("Starting up Offline MediaStreamGraph %p", graph));
+ STREAM_LOG(LogLevel::Debug, ("Starting up Offline MediaStreamGraph %p", graph));
return graph;
}
void
MediaStreamGraph::DestroyNonRealtimeInstance(MediaStreamGraph* aGraph)
{
NS_ASSERTION(NS_IsMainThread(), "Main thread only");
@@ -3358,17 +3358,17 @@ MediaStreamGraphImpl::MoveStreams(AudioC
// set their buffer start time to the appropriate value now:
if (aAudioContextOperation == AudioContextOperation::Resume &&
stream->mBufferStartTime == START_TIME_DELAYED) {
stream->mBufferStartTime = IterationEnd();
}
stream->remove();
}
- STREAM_LOG(PR_LOG_DEBUG, ("Moving streams between suspended and running"
+ STREAM_LOG(LogLevel::Debug, ("Moving streams between suspended and running"
"state: mStreams: %d, mSuspendedStreams: %d\n", mStreams.Length(),
mSuspendedStreams.Length()));
#ifdef DEBUG
// The intersection of the two arrays should be null.
for (uint32_t i = 0; i < mStreams.Length(); i++) {
for (uint32_t j = 0; j < mSuspendedStreams.Length(); j++) {
MOZ_ASSERT(
mStreams[i] != mSuspendedStreams[j],
--- a/dom/media/MediaTimer.h
+++ b/dom/media/MediaTimer.h
@@ -18,17 +18,17 @@
#include "mozilla/TimeStamp.h"
namespace mozilla {
extern PRLogModuleInfo* gMediaTimerLog;
#define TIMER_LOG(x, ...) \
MOZ_ASSERT(gMediaTimerLog); \
- MOZ_LOG(gMediaTimerLog, PR_LOG_DEBUG, ("[MediaTimer=%p relative_t=%lld]" x, this, \
+ MOZ_LOG(gMediaTimerLog, LogLevel::Debug, ("[MediaTimer=%p relative_t=%lld]" x, this, \
RelativeMicroseconds(TimeStamp::Now()), ##__VA_ARGS__))
// This promise type is only exclusive because so far there isn't a reason for
// it not to be. Feel free to change that.
typedef MediaPromise<bool, bool, /* IsExclusive = */ true> MediaTimerPromise;
// Timers only know how to fire at a given thread, which creates an impedence
// mismatch with code that operates with MediaTaskQueues. This class solves
--- a/dom/media/RtspMediaResource.cpp
+++ b/dom/media/RtspMediaResource.cpp
@@ -16,17 +16,17 @@
#include "nsIStreamingProtocolService.h"
#include "nsServiceManagerUtils.h"
#ifdef NECKO_PROTOCOL_rtsp
#include "mozilla/net/RtspChannelChild.h"
#endif
using namespace mozilla::net;
PRLogModuleInfo* gRtspMediaResourceLog;
-#define RTSP_LOG(msg, ...) MOZ_LOG(gRtspMediaResourceLog, PR_LOG_DEBUG, \
+#define RTSP_LOG(msg, ...) MOZ_LOG(gRtspMediaResourceLog, mozilla::LogLevel::Debug, \
(msg, ##__VA_ARGS__))
// Debug logging macro with object pointer and class name.
#define RTSPMLOG(msg, ...) \
RTSP_LOG("%p [RtspMediaResource]: " msg, this, ##__VA_ARGS__)
namespace mozilla {
/* class RtspTrackBuffer: a ring buffer implementation for audio/video track
--- a/dom/media/StateMirroring.h
+++ b/dom/media/StateMirroring.h
@@ -45,17 +45,17 @@
namespace mozilla {
// Mirror<T> and Canonical<T> inherit WatchTarget, so we piggy-back on the
// logging that WatchTarget already does. Given that, it makes sense to share
// the same log module.
#define MIRROR_LOG(x, ...) \
MOZ_ASSERT(gStateWatchingLog); \
- MOZ_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
+ MOZ_LOG(gStateWatchingLog, LogLevel::Debug, (x, ##__VA_ARGS__))
template<typename T> class AbstractMirror;
/*
* AbstractCanonical is a superclass from which all Canonical values must
* inherit. It serves as the interface of operations which may be performed (via
* asynchronous dispatch) by other threads, in particular by the corresponding
* Mirror value.
--- a/dom/media/StateWatching.h
+++ b/dom/media/StateWatching.h
@@ -55,17 +55,17 @@
*/
namespace mozilla {
extern PRLogModuleInfo* gStateWatchingLog;
#define WATCH_LOG(x, ...) \
MOZ_ASSERT(gStateWatchingLog); \
- MOZ_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
+ MOZ_LOG(gStateWatchingLog, LogLevel::Debug, (x, ##__VA_ARGS__))
/*
* AbstractWatcher is a superclass from which all watchers must inherit.
*/
class AbstractWatcher
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AbstractWatcher)
--- a/dom/media/StreamBuffer.cpp
+++ b/dom/media/StreamBuffer.cpp
@@ -11,23 +11,23 @@ namespace mozilla {
extern PRLogModuleInfo* gMediaStreamGraphLog;
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
#ifdef DEBUG
void
StreamBuffer::DumpTrackInfo() const
{
- STREAM_LOG(PR_LOG_INFO, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime));
+ STREAM_LOG(LogLevel::Info, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime));
for (uint32_t i = 0; i < mTracks.Length(); ++i) {
Track* track = mTracks[i];
if (track->IsEnded()) {
- STREAM_LOG(PR_LOG_INFO, ("Track[%d] %d: ended", i, track->GetID()));
+ STREAM_LOG(LogLevel::Info, ("Track[%d] %d: ended", i, track->GetID()));
} else {
- STREAM_LOG(PR_LOG_INFO, ("Track[%d] %d: %lld", i, track->GetID(),
+ STREAM_LOG(LogLevel::Info, ("Track[%d] %d: %lld", i, track->GetID(),
track->GetEnd()));
}
}
}
#endif
StreamTime
StreamBuffer::GetEnd() const
--- a/dom/media/TrackUnionStream.cpp
+++ b/dom/media/TrackUnionStream.cpp
@@ -191,17 +191,17 @@ TrackUnionStream::TrackUnionStream(DOMMe
MediaStreamListener* l = mListeners[j];
l->NotifyQueuedTrackChanges(Graph(), id, outputStart,
MediaStreamListener::TRACK_EVENT_CREATED,
*segment);
}
segment->AppendNullData(outputStart);
StreamBuffer::Track* track =
&mBuffer.AddTrack(id, outputStart, segment.forget());
- STREAM_LOG(PR_LOG_DEBUG, ("TrackUnionStream %p adding track %d for input stream %p track %d, start ticks %lld",
+ STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p adding track %d for input stream %p track %d, start ticks %lld",
this, id, aPort->GetSource(), aTrack->GetID(),
(long long)outputStart));
TrackMapEntry* map = mTrackMap.AppendElement();
map->mEndOfConsumedInputTicks = 0;
map->mEndOfLastInputIntervalInInputStream = -1;
map->mEndOfLastInputIntervalInOutputStream = -1;
map->mInputPort = aPort;
@@ -259,17 +259,17 @@ TrackUnionStream::TrackUnionStream(DOMMe
StreamTime ticks = interval.mEnd - interval.mStart;
next = interval.mEnd;
StreamTime outputStart = outputTrack->GetEnd();
if (interval.mInputIsBlocked) {
// Maybe the input track ended?
segment->AppendNullData(ticks);
- STREAM_LOG(PR_LOG_VERBOSE, ("TrackUnionStream %p appending %lld ticks of null data to track %d",
+ STREAM_LOG(LogLevel::Verbose, ("TrackUnionStream %p appending %lld ticks of null data to track %d",
this, (long long)ticks, outputTrack->GetID()));
} else if (InMutedCycle()) {
segment->AppendNullData(ticks);
} else {
if (GraphImpl()->StreamSuspended(source)) {
segment->AppendNullData(aTo - aFrom);
} else {
MOZ_ASSERT(outputTrack->GetEnd() == GraphTimeToStreamTime(interval.mStart),
--- a/dom/media/WebVTTListener.cpp
+++ b/dom/media/WebVTTListener.cpp
@@ -24,17 +24,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebVTTListener)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(WebVTTListener)
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebVTTListener)
PRLogModuleInfo* gTextTrackLog;
-# define VTT_LOG(...) MOZ_LOG(gTextTrackLog, PR_LOG_DEBUG, (__VA_ARGS__))
+# define VTT_LOG(...) MOZ_LOG(gTextTrackLog, LogLevel::Debug, (__VA_ARGS__))
WebVTTListener::WebVTTListener(HTMLTrackElement* aElement)
: mElement(aElement)
{
MOZ_ASSERT(mElement, "Must pass an element to the callback");
if (!gTextTrackLog) {
gTextTrackLog = PR_NewLogModule("TextTrack");
}
--- a/dom/media/apple/AppleMP3Reader.cpp
+++ b/dom/media/apple/AppleMP3Reader.cpp
@@ -17,19 +17,19 @@
// buffer we cannot use AudioCompactor without paying for an additional
// allocation and copy. Therefore, choosing a value that divides exactly into
// 1152 is most memory efficient.
#define MAX_AUDIO_FRAMES 128
namespace mozilla {
extern PRLogModuleInfo* gMediaDecoderLog;
-#define LOGE(...) MOZ_LOG(gMediaDecoderLog, PR_LOG_ERROR, (__VA_ARGS__))
-#define LOGW(...) MOZ_LOG(gMediaDecoderLog, PR_LOG_WARNING, (__VA_ARGS__))
-#define LOGD(...) MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOGE(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Error, (__VA_ARGS__))
+#define LOGW(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Warning, (__VA_ARGS__))
+#define LOGD(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
#define PROPERTY_ID_FORMAT "%c%c%c%c"
#define PROPERTY_ID_PRINT(x) ((x) >> 24), \
((x) >> 16) & 0xff, \
((x) >> 8) & 0xff, \
(x) & 0xff
AppleMP3Reader::AppleMP3Reader(AbstractMediaDecoder *aDecoder)
--- a/dom/media/directshow/AudioSinkFilter.cpp
+++ b/dom/media/directshow/AudioSinkFilter.cpp
@@ -19,17 +19,17 @@
DEFINE_GUID(CLSID_MozAudioSinkFilter, 0x1872d8c8, 0xea8d, 0x4c34, 0xae, 0x96, 0x69, 0xde,
0xf1, 0x33, 0x7b, 0x33);
using namespace mozilla::media;
namespace mozilla {
PRLogModuleInfo* GetDirectShowLog();
-#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
AudioSinkFilter::AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult)
: BaseFilter(aObjectName, CLSID_MozAudioSinkFilter),
mFilterCritSec("AudioSinkFilter::mFilterCritSec")
{
(*aOutResult) = S_OK;
mInputPin = new AudioSinkInputPin(L"AudioSinkInputPin",
this,
--- a/dom/media/directshow/AudioSinkInputPin.cpp
+++ b/dom/media/directshow/AudioSinkInputPin.cpp
@@ -11,17 +11,17 @@
#include <wmsdkidl.h>
using namespace mozilla::media;
namespace mozilla {
PRLogModuleInfo* GetDirectShowLog();
-#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
AudioSinkInputPin::AudioSinkInputPin(wchar_t* aObjectName,
AudioSinkFilter* aFilter,
mozilla::CriticalSection* aLock,
HRESULT* aOutResult)
: BaseInputPin(aObjectName, aFilter, aLock, aOutResult, aObjectName),
mSegmentStartTime(0)
{
--- a/dom/media/directshow/DirectShowReader.cpp
+++ b/dom/media/directshow/DirectShowReader.cpp
@@ -21,17 +21,17 @@ PRLogModuleInfo*
GetDirectShowLog() {
static PRLogModuleInfo* log = nullptr;
if (!log) {
log = PR_NewLogModule("DirectShowDecoder");
}
return log;
}
-#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
DirectShowReader::DirectShowReader(AbstractMediaDecoder* aDecoder)
: MediaDecoderReader(aDecoder),
mMP3FrameParser(aDecoder->GetResource()->GetLength()),
#ifdef DEBUG
mRotRegister(0),
#endif
mNumChannels(0),
--- a/dom/media/directshow/SampleSink.cpp
+++ b/dom/media/directshow/SampleSink.cpp
@@ -10,17 +10,17 @@
#include "VideoUtils.h"
#include "mozilla/Logging.h"
using namespace mozilla::media;
namespace mozilla {
PRLogModuleInfo* GetDirectShowLog();
-#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
SampleSink::SampleSink()
: mMonitor("SampleSink"),
mIsFlushing(false),
mAtEOS(false)
{
MOZ_COUNT_CTOR(SampleSink);
}
@@ -60,17 +60,17 @@ SampleSink::Receive(IMediaSample* aSampl
}
if (mAtEOS) {
return E_UNEXPECTED;
}
// Wait until the consumer thread consumes the sample.
mon.Wait();
}
- if (MOZ_LOG_TEST(GetDirectShowLog(), PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(GetDirectShowLog(), LogLevel::Debug)) {
REFERENCE_TIME start = 0, end = 0;
HRESULT hr = aSample->GetMediaTime(&start, &end);
LOG("SampleSink::Receive() [%4.2lf-%4.2lf]",
(double)RefTimeToUsecs(start) / USECS_PER_S,
(double)RefTimeToUsecs(end) / USECS_PER_S);
}
mSample = aSample;
@@ -97,17 +97,17 @@ SampleSink::Extract(RefPtr<IMediaSample>
// before reporting EOS.
return E_UNEXPECTED;
}
// Wait until the producer thread gives us a sample.
mon.Wait();
}
aOutSample = mSample;
- if (MOZ_LOG_TEST(GetDirectShowLog(), PR_LOG_DEBUG)) {
+ if (MOZ_LOG_TEST(GetDirectShowLog(), LogLevel::Debug)) {
int64_t start = 0, end = 0;
mSample->GetMediaTime(&start, &end);
LOG("SampleSink::Extract() [%4.2lf-%4.2lf]",
(double)RefTimeToUsecs(start) / USECS_PER_S,
(double)RefTimeToUsecs(end) / USECS_PER_S);
}
mSample = nullptr;
--- a/dom/media/directshow/SourceFilter.cpp
+++ b/dom/media/directshow/SourceFilter.cpp
@@ -16,17 +16,17 @@ using namespace mozilla::media;
namespace mozilla {
// Define to trace what's on...
//#define DEBUG_SOURCE_TRACE 1
#if defined (DEBUG_SOURCE_TRACE)
PRLogModuleInfo* GetDirectShowLog();
-#define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#else
#define DIRECTSHOW_LOG(...)
#endif
static HRESULT
DoGetInterface(IUnknown* aUnknown, void** aInterface)
{
if (!aInterface)
--- a/dom/media/eme/EMEUtils.h
+++ b/dom/media/eme/EMEUtils.h
@@ -9,23 +9,23 @@
#include "mozilla/Logging.h"
#include "nsString.h"
namespace mozilla {
#ifndef EME_LOG
PRLogModuleInfo* GetEMELog();
- #define EME_LOG(...) MOZ_LOG(GetEMELog(), PR_LOG_DEBUG, (__VA_ARGS__))
- #define EME_LOG_ENABLED() MOZ_LOG_TEST(GetEMELog(), PR_LOG_DEBUG)
+ #define EME_LOG(...) MOZ_LOG(GetEMELog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
+ #define EME_LOG_ENABLED() MOZ_LOG_TEST(GetEMELog(), mozilla::LogLevel::Debug)
#endif
#ifndef EME_VERBOSE_LOG
PRLogModuleInfo* GetEMEVerboseLog();
- #define EME_VERBOSE_LOG(...) MOZ_LOG(GetEMEVerboseLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+ #define EME_VERBOSE_LOG(...) MOZ_LOG(GetEMEVerboseLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#else
#ifndef EME_LOG
#define EME_LOG(...)
#endif
#ifndef EME_VERBOSE_LOG
#define EME_VERBOSE_LOG(...)
#endif
--- a/dom/media/encoder/MediaEncoder.cpp
+++ b/dom/media/encoder/MediaEncoder.cpp
@@ -57,17 +57,17 @@ MediaEncoder::NotifyQueuedTrackChanges(M
}
}
void
MediaEncoder::NotifyEvent(MediaStreamGraph* aGraph,
MediaStreamListener::MediaStreamGraphEvent event)
{
// In case that MediaEncoder does not receive a TRACK_EVENT_ENDED event.
- LOG(PR_LOG_DEBUG, ("NotifyRemoved in [MediaEncoder]."));
+ LOG(LogLevel::Debug, ("NotifyRemoved in [MediaEncoder]."));
if (mAudioEncoder) {
mAudioEncoder->NotifyEvent(aGraph, event);
}
if (mVideoEncoder) {
mVideoEncoder->NotifyEvent(aGraph, event);
}
}
@@ -82,17 +82,17 @@ MediaEncoder::CreateEncoder(const nsAStr
js::ProfileEntry::Category::OTHER);
nsAutoPtr<ContainerWriter> writer;
nsAutoPtr<AudioTrackEncoder> audioEncoder;
nsAutoPtr<VideoTrackEncoder> videoEncoder;
nsRefPtr<MediaEncoder> encoder;
nsString mimeType;
if (!aTrackTypes) {
- LOG(PR_LOG_ERROR, ("NO TrackTypes!!!"));
+ LOG(LogLevel::Error, ("NO TrackTypes!!!"));
return nullptr;
}
#ifdef MOZ_WEBM_ENCODER
else if (MediaEncoder::IsWebMEncoderEnabled() &&
(aMIMEType.EqualsLiteral(VIDEO_WEBM) ||
(aTrackTypes & ContainerWriter::CREATE_VIDEO_TRACK))) {
if (aTrackTypes & ContainerWriter::CREATE_AUDIO_TRACK) {
audioEncoder = new VorbisTrackEncoder();
@@ -133,20 +133,20 @@ MediaEncoder::CreateEncoder(const nsAStr
(aTrackTypes & ContainerWriter::CREATE_AUDIO_TRACK))) {
writer = new OggWriter();
audioEncoder = new OpusTrackEncoder();
NS_ENSURE_TRUE(writer, nullptr);
NS_ENSURE_TRUE(audioEncoder, nullptr);
mimeType = NS_LITERAL_STRING(AUDIO_OGG);
}
else {
- LOG(PR_LOG_ERROR, ("Can not find any encoder to record this media stream"));
+ LOG(LogLevel::Error, ("Can not find any encoder to record this media stream"));
return nullptr;
}
- LOG(PR_LOG_DEBUG, ("Create encoder result:a[%d] v[%d] w[%d] mimeType = %s.",
+ LOG(LogLevel::Debug, ("Create encoder result:a[%d] v[%d] w[%d] mimeType = %s.",
audioEncoder != nullptr, videoEncoder != nullptr,
writer != nullptr, mimeType.get()));
encoder = new MediaEncoder(writer.forget(), audioEncoder.forget(),
videoEncoder.forget(), mimeType);
return encoder.forget();
}
/**
@@ -182,82 +182,82 @@ MediaEncoder::GetEncodedData(nsTArray<ns
aMIMEType = mMIMEType;
PROFILER_LABEL("MediaEncoder", "GetEncodedData",
js::ProfileEntry::Category::OTHER);
bool reloop = true;
while (reloop) {
switch (mState) {
case ENCODE_METADDATA: {
- LOG(PR_LOG_DEBUG, ("ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp()));
+ LOG(LogLevel::Debug, ("ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp()));
nsresult rv = CopyMetadataToMuxer(mAudioEncoder.get());
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, ("Error! Fail to Set Audio Metadata"));
+ LOG(LogLevel::Error, ("Error! Fail to Set Audio Metadata"));
break;
}
rv = CopyMetadataToMuxer(mVideoEncoder.get());
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, ("Error! Fail to Set Video Metadata"));
+ LOG(LogLevel::Error, ("Error! Fail to Set Video Metadata"));
break;
}
rv = mWriter->GetContainerData(aOutputBufs,
ContainerWriter::GET_HEADER);
if (aOutputBufs != nullptr) {
mSizeOfBuffer = aOutputBufs->SizeOfExcludingThis(MallocSizeOf);
}
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR,("Error! writer fail to generate header!"));
+ LOG(LogLevel::Error,("Error! writer fail to generate header!"));
mState = ENCODE_ERROR;
break;
}
- LOG(PR_LOG_DEBUG, ("Finish ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp()));
+ LOG(LogLevel::Debug, ("Finish ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp()));
mState = ENCODE_TRACK;
break;
}
case ENCODE_TRACK: {
- LOG(PR_LOG_DEBUG, ("ENCODE_TRACK TimeStamp = %f", GetEncodeTimeStamp()));
+ LOG(LogLevel::Debug, ("ENCODE_TRACK TimeStamp = %f", GetEncodeTimeStamp()));
EncodedFrameContainer encodedData;
nsresult rv = NS_OK;
rv = WriteEncodedDataToMuxer(mAudioEncoder.get());
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, ("Error! Fail to write audio encoder data to muxer"));
+ LOG(LogLevel::Error, ("Error! Fail to write audio encoder data to muxer"));
break;
}
- LOG(PR_LOG_DEBUG, ("Audio encoded TimeStamp = %f", GetEncodeTimeStamp()));
+ LOG(LogLevel::Debug, ("Audio encoded TimeStamp = %f", GetEncodeTimeStamp()));
rv = WriteEncodedDataToMuxer(mVideoEncoder.get());
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, ("Fail to write video encoder data to muxer"));
+ LOG(LogLevel::Error, ("Fail to write video encoder data to muxer"));
break;
}
- LOG(PR_LOG_DEBUG, ("Video encoded TimeStamp = %f", GetEncodeTimeStamp()));
+ LOG(LogLevel::Debug, ("Video encoded TimeStamp = %f", GetEncodeTimeStamp()));
// In audio only or video only case, let unavailable track's flag to be true.
bool isAudioCompleted = (mAudioEncoder && mAudioEncoder->IsEncodingComplete()) || !mAudioEncoder;
bool isVideoCompleted = (mVideoEncoder && mVideoEncoder->IsEncodingComplete()) || !mVideoEncoder;
rv = mWriter->GetContainerData(aOutputBufs,
isAudioCompleted && isVideoCompleted ?
ContainerWriter::FLUSH_NEEDED : 0);
if (aOutputBufs != nullptr) {
mSizeOfBuffer = aOutputBufs->SizeOfExcludingThis(MallocSizeOf);
}
if (NS_SUCCEEDED(rv)) {
// Successfully get the copy of final container data from writer.
reloop = false;
}
mState = (mWriter->IsWritingComplete()) ? ENCODE_DONE : ENCODE_TRACK;
- LOG(PR_LOG_DEBUG, ("END ENCODE_TRACK TimeStamp = %f "
+ LOG(LogLevel::Debug, ("END ENCODE_TRACK TimeStamp = %f "
"mState = %d aComplete %d vComplete %d",
GetEncodeTimeStamp(), mState, isAudioCompleted, isVideoCompleted));
break;
}
case ENCODE_DONE:
case ENCODE_ERROR:
- LOG(PR_LOG_DEBUG, ("MediaEncoder has been shutdown."));
+ LOG(LogLevel::Debug, ("MediaEncoder has been shutdown."));
mSizeOfBuffer = 0;
mShutdown = true;
reloop = false;
break;
default:
MOZ_CRASH("Invalid encode state");
}
}
@@ -275,25 +275,25 @@ MediaEncoder::WriteEncodedDataToMuxer(Tr
PROFILER_LABEL("MediaEncoder", "WriteEncodedDataToMuxer",
js::ProfileEntry::Category::OTHER);
EncodedFrameContainer encodedVideoData;
nsresult rv = aTrackEncoder->GetEncodedTrack(encodedVideoData);
if (NS_FAILED(rv)) {
// Encoding might be canceled.
- LOG(PR_LOG_ERROR, ("Error! Fail to get encoded data from video encoder."));
+ LOG(LogLevel::Error, ("Error! Fail to get encoded data from video encoder."));
mState = ENCODE_ERROR;
return rv;
}
rv = mWriter->WriteEncodedTrack(encodedVideoData,
aTrackEncoder->IsEncodingComplete() ?
ContainerWriter::END_OF_STREAM : 0);
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, ("Error! Fail to write encoded video track to the media container."));
+ LOG(LogLevel::Error, ("Error! Fail to write encoded video track to the media container."));
mState = ENCODE_ERROR;
}
return rv;
}
nsresult
MediaEncoder::CopyMetadataToMuxer(TrackEncoder *aTrackEncoder)
{
@@ -301,24 +301,24 @@ MediaEncoder::CopyMetadataToMuxer(TrackE
return NS_OK;
}
PROFILER_LABEL("MediaEncoder", "CopyMetadataToMuxer",
js::ProfileEntry::Category::OTHER);
nsRefPtr<TrackMetadataBase> meta = aTrackEncoder->GetMetadata();
if (meta == nullptr) {
- LOG(PR_LOG_ERROR, ("Error! metadata = null"));
+ LOG(LogLevel::Error, ("Error! metadata = null"));
mState = ENCODE_ERROR;
return NS_ERROR_ABORT;
}
nsresult rv = mWriter->SetMetadata(meta);
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, ("Error! SetMetadata fail"));
+ LOG(LogLevel::Error, ("Error! SetMetadata fail"));
mState = ENCODE_ERROR;
}
return rv;
}
#ifdef MOZ_WEBM_ENCODER
bool
MediaEncoder::IsWebMEncoderEnabled()
--- a/dom/media/encoder/TrackEncoder.cpp
+++ b/dom/media/encoder/TrackEncoder.cpp
@@ -53,17 +53,17 @@ AudioTrackEncoder::NotifyQueuedTrackChan
return;
}
const AudioSegment& audio = static_cast<const AudioSegment&>(aQueuedMedia);
// Check and initialize parameters for codec encoder.
if (!mInitialized) {
mAudioInitCounter++;
- TRACK_LOG(PR_LOG_DEBUG, ("Init the audio encoder %d times", mAudioInitCounter));
+ TRACK_LOG(LogLevel::Debug, ("Init the audio encoder %d times", mAudioInitCounter));
AudioSegment::ChunkIterator iter(const_cast<AudioSegment&>(audio));
while (!iter.IsEnded()) {
AudioChunk chunk = *iter;
// The number of channels is determined by the first non-null chunk, and
// thus the audio encoder is initialized at this time.
if (!chunk.IsNull()) {
nsresult rv = Init(chunk.mChannelData.Length(), aGraph->GraphRate());
@@ -179,17 +179,17 @@ VideoTrackEncoder::NotifyQueuedTrackChan
return;
}
const VideoSegment& video = static_cast<const VideoSegment&>(aQueuedMedia);
// Check and initialize parameters for codec encoder.
if (!mInitialized) {
mVideoInitCounter++;
- TRACK_LOG(PR_LOG_DEBUG, ("Init the video encoder %d times", mVideoInitCounter));
+ TRACK_LOG(LogLevel::Debug, ("Init the video encoder %d times", mVideoInitCounter));
VideoSegment::ChunkIterator iter(const_cast<VideoSegment&>(video));
while (!iter.IsEnded()) {
VideoChunk chunk = *iter;
if (!chunk.IsNull()) {
gfx::IntSize imgsize = chunk.mFrame.GetImage()->GetSize();
gfxIntSize intrinsicSize = chunk.mFrame.GetIntrinsicSize();
nsresult rv = Init(imgsize.width, imgsize.height,
intrinsicSize.width, intrinsicSize.height,
--- a/dom/media/encoder/VP8TrackEncoder.cpp
+++ b/dom/media/encoder/VP8TrackEncoder.cpp
@@ -11,17 +11,17 @@
#include "prsystem.h"
#include "WebMWriter.h"
#include "libyuv.h"
#include "GeckoProfiler.h"
namespace mozilla {
PRLogModuleInfo* gVP8TrackEncoderLog;
-#define VP8LOG(msg, ...) MOZ_LOG(gVP8TrackEncoderLog, PR_LOG_DEBUG, \
+#define VP8LOG(msg, ...) MOZ_LOG(gVP8TrackEncoderLog, mozilla::LogLevel::Debug, \
(msg, ##__VA_ARGS__))
// Debug logging macro with object pointer and class name.
#define DEFAULT_BITRATE 2500 // in kbit/s
#define DEFAULT_ENCODE_FRAMERATE 30
using namespace mozilla::layers;
--- a/dom/media/encoder/VorbisTrackEncoder.cpp
+++ b/dom/media/encoder/VorbisTrackEncoder.cpp
@@ -13,17 +13,17 @@
// Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR
// ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
static const float BASE_QUALITY = 0.4f;
namespace mozilla {
#undef LOG
PRLogModuleInfo* gVorbisTrackEncoderLog;
-#define VORBISLOG(msg, ...) MOZ_LOG(gVorbisTrackEncoderLog, PR_LOG_DEBUG, \
+#define VORBISLOG(msg, ...) MOZ_LOG(gVorbisTrackEncoderLog, mozilla::LogLevel::Debug, \
(msg, ##__VA_ARGS__))
VorbisTrackEncoder::VorbisTrackEncoder()
: AudioTrackEncoder()
{
MOZ_COUNT_CTOR(VorbisTrackEncoder);
if (!gVorbisTrackEncoderLog) {
gVorbisTrackEncoderLog = PR_NewLogModule("VorbisTrackEncoder");
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -35,18 +35,18 @@ using mozilla::layers::LayersBackend;
PRLogModuleInfo* GetDemuxerLog() {
static PRLogModuleInfo* log = nullptr;
if (!log) {
log = PR_NewLogModule("MP4Demuxer");
}
return log;
}
-#define LOG(arg, ...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define VLOG(arg, ...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define LOG(arg, ...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define VLOG(arg, ...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
using namespace mp4_demuxer;
namespace mozilla {
// Uncomment to enable verbose per-sample logging.
//#define LOG_SAMPLE_DECODE 1
--- a/dom/media/gmp/GMPAudioDecoderParent.cpp
+++ b/dom/media/gmp/GMPAudioDecoderParent.cpp
@@ -14,17 +14,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
extern PRLogModuleInfo* GetGMPLog();
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
namespace gmp {
GMPAudioDecoderParent::GMPAudioDecoderParent(GMPContentParent* aPlugin)
: mIsOpen(false)
, mShuttingDown(false)
, mActorDestroyed(false)
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -42,17 +42,17 @@ static const int MAX_VOUCHER_LENGTH = 50
namespace mozilla {
#undef LOG
#undef LOGD
extern PRLogModuleInfo* GetGMPLog();
#define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
-#define LOGD(x, ...) LOG(PR_LOG_DEBUG, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__)
+#define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__)
namespace gmp {
GMPChild::GMPChild()
: mAsyncShutdown(nullptr)
, mGMPMessageLoop(MessageLoop::current())
, mGMPLoader(nullptr)
{
--- a/dom/media/gmp/GMPContentParent.cpp
+++ b/dom/media/gmp/GMPContentParent.cpp
@@ -17,17 +17,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
extern PRLogModuleInfo* GetGMPLog();
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPContentParent"
namespace gmp {
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -39,17 +39,17 @@ using CrashReporter::GetIDFromMinidump;
namespace mozilla {
#undef LOG
#undef LOGD
extern PRLogModuleInfo* GetGMPLog();
#define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
-#define LOGD(x, ...) LOG(PR_LOG_DEBUG, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__)
+#define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPParent"
namespace gmp {
--- a/dom/media/gmp/GMPService.cpp
+++ b/dom/media/gmp/GMPService.cpp
@@ -47,17 +47,17 @@ PRLogModuleInfo*
GetGMPLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("GMP");
return sLog;
}
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPService"
namespace gmp {
--- a/dom/media/gmp/GMPServiceChild.cpp
+++ b/dom/media/gmp/GMPServiceChild.cpp
@@ -15,17 +15,17 @@
#include "runnable_utils.h"
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPService"
namespace gmp {
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -36,17 +36,17 @@
#include "nsISimpleEnumerator.h"
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPService"
namespace gmp {
--- a/dom/media/gmp/GMPStorageParent.cpp
+++ b/dom/media/gmp/GMPStorageParent.cpp
@@ -23,17 +23,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
extern PRLogModuleInfo* GetGMPLog();
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPStorageParent"
namespace gmp {
--- a/dom/media/gmp/GMPTimerParent.cpp
+++ b/dom/media/gmp/GMPTimerParent.cpp
@@ -10,17 +10,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
extern PRLogModuleInfo* GetGMPLog();
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPParent"
namespace gmp {
--- a/dom/media/gmp/GMPVideoDecoderParent.cpp
+++ b/dom/media/gmp/GMPVideoDecoderParent.cpp
@@ -18,17 +18,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
extern PRLogModuleInfo* GetGMPLog();
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
namespace gmp {
// States:
// Initial: mIsOpen == false
// on InitDecode success -> Open
// on Shutdown -> Dead
@@ -240,17 +240,17 @@ GMPVideoDecoderParent::ActorDestroy(Acto
bool
GMPVideoDecoderParent::RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame)
{
if (!mCallback) {
return false;
}
if (!GMPVideoi420FrameImpl::CheckFrameData(aDecodedFrame)) {
- LOG(PR_LOG_ERROR, ("%s: Decoded frame corrupt, ignoring", __FUNCTION__));
+ LOG(LogLevel::Error, ("%s: Decoded frame corrupt, ignoring", __FUNCTION__));
return false;
}
auto f = new GMPVideoi420FrameImpl(aDecodedFrame, &mVideoHost);
// Ignore any return code. It is OK for this to fail without killing the process.
mCallback->Decoded(f);
return true;
@@ -356,17 +356,17 @@ GMPVideoDecoderParent::AnswerNeedShmem(c
Shmem* aMem)
{
ipc::Shmem mem;
if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData,
aFrameBufferSize,
ipc::SharedMemory::TYPE_BASIC, &mem))
{
- LOG(PR_LOG_ERROR, ("%s: Failed to get a shared mem buffer for Child! size %u",
+ LOG(LogLevel::Error, ("%s: Failed to get a shared mem buffer for Child! size %u",
__FUNCTION__, aFrameBufferSize));
return false;
}
*aMem = mem;
mem = ipc::Shmem();
return true;
}
--- a/dom/media/gmp/GMPVideoEncoderParent.cpp
+++ b/dom/media/gmp/GMPVideoEncoderParent.cpp
@@ -20,17 +20,17 @@
namespace mozilla {
#ifdef LOG
#undef LOG
#endif
extern PRLogModuleInfo* GetGMPLog();
-#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
+#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPVideoEncoderParent"
namespace gmp {
@@ -347,17 +347,17 @@ GMPVideoEncoderParent::AnswerNeedShmem(c
Shmem* aMem)
{
ipc::Shmem mem;
if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData,
aEncodedBufferSize,
ipc::SharedMemory::TYPE_BASIC, &mem))
{
- LOG(PR_LOG_ERROR, ("%s::%s: Failed to get a shared mem buffer for Child! size %u",
+ LOG(LogLevel::Error, ("%s::%s: Failed to get a shared mem buffer for Child! size %u",
__CLASS__, __FUNCTION__, aEncodedBufferSize));
return false;
}
*aMem = mem;
mem = ipc::Shmem();
return true;
}
--- a/dom/media/gstreamer/GStreamerReader.cpp
+++ b/dom/media/gstreamer/GStreamerReader.cpp
@@ -126,17 +126,17 @@ nsresult GStreamerReader::Init(MediaDeco
#endif
#if GST_VERSION_MAJOR >= 1
mPlayBin = gst_element_factory_make("playbin", nullptr);
#else
mPlayBin = gst_element_factory_make("playbin2", nullptr);
#endif
if (!mPlayBin) {
- LOG(PR_LOG_ERROR, "couldn't create playbin");
+ LOG(LogLevel::Error, "couldn't create playbin");
return NS_ERROR_FAILURE;
}
g_object_set(mPlayBin, "buffer-size", 0, nullptr);
mBus = gst_pipeline_get_bus(GST_PIPELINE(mPlayBin));
mVideoSink = gst_parse_bin_from_description("capsfilter name=filter ! "
"appsink name=videosink sync=false max-buffers=1 "
#if GST_VERSION_MAJOR >= 1
@@ -289,22 +289,22 @@ void GStreamerReader::PlayBinSourceSetup
/* now we should have a length */
int64_t resourceLength = GetDataLength();
gst_app_src_set_size(mSource, resourceLength);
if (resource->IsDataCachedToEndOfResource(0) ||
(resourceLength != -1 && resourceLength <= SHORT_FILE_SIZE)) {
/* let the demuxer work in pull mode for local files (or very short files)
* so that we get optimal seeking accuracy/performance
*/
- LOG(PR_LOG_DEBUG, "configuring random access, len %lld", resourceLength);
+ LOG(LogLevel::Debug, "configuring random access, len %lld", resourceLength);
gst_app_src_set_stream_type(mSource, GST_APP_STREAM_TYPE_RANDOM_ACCESS);
} else {
/* make the demuxer work in push mode so that seeking is kept to a minimum
*/
- LOG(PR_LOG_DEBUG, "configuring push mode, len %lld", resourceLength);
+ LOG(LogLevel::Debug, "configuring push mode, len %lld", resourceLength);
gst_app_src_set_stream_type(mSource, GST_APP_STREAM_TYPE_SEEKABLE);
}
// Set the source MIME type to stop typefind trying every. single. format.
GstCaps *caps =
GStreamerFormatHelper::ConvertFormatsToCaps(mDecoder->GetResource()->GetContentType().get(),
nullptr);
@@ -411,42 +411,42 @@ nsresult GStreamerReader::ReadMetadata(M
* find a decoder for the stream we want to skip.
*/
GstCaps* filterCaps = gst_caps_new_simple ("skip", nullptr, nullptr);
g_object_set(filter, "caps", filterCaps, nullptr);
gst_caps_unref(filterCaps);
gst_object_unref(filter);
}
- LOG(PR_LOG_DEBUG, "starting metadata pipeline");
+ LOG(LogLevel::Debug, "starting metadata pipeline");
if (gst_element_set_state(mPlayBin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
- LOG(PR_LOG_DEBUG, "metadata pipeline state change failed");
+ LOG(LogLevel::Debug, "metadata pipeline state change failed");
ret = NS_ERROR_FAILURE;
continue;
}
/* Wait for ASYNC_DONE, which is emitted when the pipeline is built,
* prerolled and ready to play. Also watch for errors.
*/
message = gst_bus_timed_pop_filtered(mBus, GST_CLOCK_TIME_NONE,
(GstMessageType)(GST_MESSAGE_ASYNC_DONE | GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ASYNC_DONE) {
- LOG(PR_LOG_DEBUG, "read metadata pipeline prerolled");
+ LOG(LogLevel::Debug, "read metadata pipeline prerolled");
gst_message_unref(message);
ret = NS_OK;
break;
} else {
- LOG(PR_LOG_DEBUG, "read metadata pipeline failed to preroll: %s",
+ LOG(LogLevel::Debug, "read metadata pipeline failed to preroll: %s",
gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) {
GError* error;
gchar* debug;
gst_message_parse_error(message, &error, &debug);
- LOG(PR_LOG_ERROR, "read metadata error: %s: %s", error->message, debug);
+ LOG(LogLevel::Error, "read metadata error: %s: %s", error->message, debug);
g_error_free(error);
g_free(debug);
}
/* Unexpected stream close/EOS or other error. We'll give up if all
* streams are in error/eos. */
gst_element_set_state(mPlayBin, GST_STATE_NULL);
gst_message_unref(message);
ret = NS_ERROR_FAILURE;
@@ -466,28 +466,28 @@ nsresult GStreamerReader::ReadMetadata(M
if (isMP3 && mMP3FrameParser.IsMP3()) {
// The MP3FrameParser has reported a duration; use that over the gstreamer
// reported duration for inter-platform consistency.
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mUseParserDuration = true;
mLastParserDuration = mMP3FrameParser.GetDuration();
mDecoder->SetMediaDuration(mLastParserDuration);
} else {
- LOG(PR_LOG_DEBUG, "querying duration");
+ LOG(LogLevel::Debug, "querying duration");
// Otherwise use the gstreamer duration.
#if GST_VERSION_MAJOR >= 1
if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
GST_FORMAT_TIME, &duration)) {
#else
GstFormat format = GST_FORMAT_TIME;
if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
&format, &duration) && format == GST_FORMAT_TIME) {
#endif
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
- LOG(PR_LOG_DEBUG, "have duration %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));
+ LOG(LogLevel::Debug, "have duration %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));
duration = GST_TIME_AS_USECONDS (duration);
mDecoder->SetMediaDuration(duration);
}
}
int n_video = 0, n_audio = 0;
g_object_get(mPlayBin, "n-video", &n_video, "n-audio", &n_audio, nullptr);
@@ -609,34 +609,34 @@ nsresult GStreamerReader::CheckSupported
return unsupported ? NS_ERROR_FAILURE : NS_OK;
}
nsresult GStreamerReader::ResetDecode()
{
nsresult res = NS_OK;
- LOG(PR_LOG_DEBUG, "reset decode");
+ LOG(LogLevel::Debug, "reset decode");
if (NS_FAILED(MediaDecoderReader::ResetDecode())) {
res = NS_ERROR_FAILURE;
}
mVideoQueue.Reset();
mAudioQueue.Reset();
mVideoSinkBufferCount = 0;
mAudioSinkBufferCount = 0;
mReachedAudioEos = false;
mReachedVideoEos = false;
#if GST_VERSION_MAJOR >= 1
mConfigureAlignment = true;
#endif
- LOG(PR_LOG_DEBUG, "reset decode done");
+ LOG(LogLevel::Debug, "reset decode done");
return res;
}
bool GStreamerReader::DecodeAudioData()
{
MOZ_ASSERT(OnTaskQueue());
@@ -789,17 +789,17 @@ bool GStreamerReader::DecodeVideoFrame(b
int64_t duration = 0;
if (GST_CLOCK_TIME_IS_VALID(GST_BUFFER_DURATION(buffer)))
duration = GST_TIME_AS_USECONDS(GST_BUFFER_DURATION(buffer));
else if (fpsNum && fpsDen)
/* add 1-frame duration */
duration = gst_util_uint64_scale(GST_USECOND, fpsDen, fpsNum);
if (timestamp < aTimeThreshold) {
- LOG(PR_LOG_DEBUG, "skipping frame %" GST_TIME_FORMAT
+ LOG(LogLevel::Debug, "skipping frame %" GST_TIME_FORMAT
" threshold %" GST_TIME_FORMAT,
GST_TIME_ARGS(timestamp * 1000),
GST_TIME_ARGS(aTimeThreshold * 1000));
gst_buffer_unref(buffer);
return true;
}
if (!buffer)
@@ -842,32 +842,32 @@ bool GStreamerReader::DecodeVideoFrame(b
}
nsRefPtr<MediaDecoderReader::SeekPromise>
GStreamerReader::Seek(int64_t aTarget, int64_t aEndTime)
{
MOZ_ASSERT(OnTaskQueue());
gint64 seekPos = aTarget * GST_USECOND;
- LOG(PR_LOG_DEBUG, "%p About to seek to %" GST_TIME_FORMAT,
+ LOG(LogLevel::Debug, "%p About to seek to %" GST_TIME_FORMAT,
mDecoder, GST_TIME_ARGS(seekPos));
int flags = GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT;
if (!gst_element_seek_simple(mPlayBin,
GST_FORMAT_TIME,
static_cast<GstSeekFlags>(flags),
seekPos)) {
- LOG(PR_LOG_ERROR, "seek failed");
+ LOG(LogLevel::Error, "seek failed");
return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
- LOG(PR_LOG_DEBUG, "seek succeeded");
+ LOG(LogLevel::Debug, "seek succeeded");
GstMessage* message = gst_bus_timed_pop_filtered(mBus, GST_CLOCK_TIME_NONE,
(GstMessageType)(GST_MESSAGE_ASYNC_DONE | GST_MESSAGE_ERROR));
gst_message_unref(message);
- LOG(PR_LOG_DEBUG, "seek completed");
+ LOG(LogLevel::Debug, "seek completed");
return SeekPromise::CreateAndResolve(aTarget, __func__);
}
media::TimeIntervals GStreamerReader::GetBuffered()
{
media::TimeIntervals buffered;
if (!mInfo.HasValidMedia()) {
@@ -885,17 +885,17 @@ media::TimeIntervals GStreamerReader::Ge
/* fast path for local or completely cached files */
gint64 duration = 0;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
duration = mDecoder->GetMediaDuration();
}
- LOG(PR_LOG_DEBUG, "complete range [0, %f] for [0, %li]",
+ LOG(LogLevel::Debug, "complete range [0, %f] for [0, %li]",
(double) duration / GST_MSECOND, GetDataLength());
buffered +=
media::TimeInterval(media::TimeUnit::FromMicroseconds(0),
media::TimeUnit::FromMicroseconds(duration));
return buffered;
}
for(uint32_t index = 0; index < ranges.Length(); index++) {
@@ -914,17 +914,17 @@ media::TimeIntervals GStreamerReader::Ge
if (!gst_element_query_convert(GST_ELEMENT(mPlayBin), GST_FORMAT_BYTES,
startOffset, &format, &startTime) || format != GST_FORMAT_TIME)
continue;
if (!gst_element_query_convert(GST_ELEMENT(mPlayBin), GST_FORMAT_BYTES,
endOffset, &format, &endTime) || format != GST_FORMAT_TIME)
continue;
#endif
- LOG(PR_LOG_DEBUG, "adding range [%f, %f] for [%li %li] size %li",
+ LOG(LogLevel::Debug, "adding range [%f, %f] for [%li %li] size %li",
(double) GST_TIME_AS_USECONDS (startTime) / GST_MSECOND,
(double) GST_TIME_AS_USECONDS (endTime) / GST_MSECOND,
startOffset, endOffset, GetDataLength());
buffered +=
media::TimeInterval(media::TimeUnit::FromMicroseconds(GST_TIME_AS_USECONDS(startTime)),
media::TimeUnit::FromMicroseconds(GST_TIME_AS_USECONDS(endTime)));
}
@@ -964,26 +964,26 @@ void GStreamerReader::ReadAndPushData(gu
gst_buffer_unmap(buffer, &info);
gst_buffer_set_size(buffer, bytesRead);
#else
GST_BUFFER_SIZE(buffer) = bytesRead;
#endif
GstFlowReturn ret = gst_app_src_push_buffer(mSource, gst_buffer_ref(buffer));
if (ret != GST_FLOW_OK) {
- LOG(PR_LOG_ERROR, "ReadAndPushData push ret %s(%d)", gst_flow_get_name(ret), ret);
+ LOG(LogLevel::Error, "ReadAndPushData push ret %s(%d)", gst_flow_get_name(ret), ret);
}
if (NS_FAILED(rv)) {
/* Terminate the stream if there is an error in reading */
- LOG(PR_LOG_ERROR, "ReadAndPushData read error, rv=%x", rv);
+ LOG(LogLevel::Error, "ReadAndPushData read error, rv=%x", rv);
gst_app_src_end_of_stream(mSource);
} else if (bytesRead < aLength) {
/* If we read less than what we wanted, we reached the end */
- LOG(PR_LOG_WARNING, "ReadAndPushData read underflow, "
+ LOG(LogLevel::Warning, "ReadAndPushData read underflow, "
"bytesRead=%u, aLength=%u, offset(%lld,%lld)",
bytesRead, aLength, offset1, offset2);
gst_app_src_end_of_stream(mSource);
}
gst_buffer_unref(buffer);
/* Ensure offset change is consistent in this function.
@@ -1042,17 +1042,17 @@ gboolean GStreamerReader::SeekData(GstAp
}
nsresult rv = NS_ERROR_FAILURE;
if (aOffset < static_cast<guint64>(resourceLength)) {
rv = resource->Seek(SEEK_SET, aOffset);
}
if (NS_FAILED(rv)) {
- LOG(PR_LOG_ERROR, "seek at %lu failed", aOffset);
+ LOG(LogLevel::Error, "seek at %lu failed", aOffset);
} else {
MOZ_ASSERT(aOffset == static_cast<guint64>(resource->Tell()));
}
return NS_SUCCEEDED(rv);
}
GstFlowReturn GStreamerReader::NewPrerollCb(GstAppSink* aSink,
@@ -1065,17 +1065,17 @@ GstFlowReturn GStreamerReader::NewPrerol
else
reader->AudioPreroll();
return GST_FLOW_OK;
}
void GStreamerReader::AudioPreroll()
{
/* The first audio buffer has reached the audio sink. Get rate and channels */
- LOG(PR_LOG_DEBUG, "Audio preroll");
+ LOG(LogLevel::Debug, "Audio preroll");
GstPad* sinkpad = gst_element_get_static_pad(GST_ELEMENT(mAudioAppSink), "sink");
#if GST_VERSION_MAJOR >= 1
GstCaps *caps = gst_pad_get_current_caps(sinkpad);
#else
GstCaps* caps = gst_pad_get_negotiated_caps(sinkpad);
#endif
GstStructure* s = gst_caps_get_structure(caps, 0);
mInfo.mAudio.mRate = mInfo.mAudio.mChannels = 0;
@@ -1087,17 +1087,17 @@ void GStreamerReader::AudioPreroll()
"invalid audio channels number");
gst_caps_unref(caps);
gst_object_unref(sinkpad);
}
void GStreamerReader::VideoPreroll()
{
/* The first video buffer has reached the video sink. Get width and height */
- LOG(PR_LOG_DEBUG, "Video preroll");
+ LOG(LogLevel::Debug, "Video preroll");
GstPad* sinkpad = gst_element_get_static_pad(GST_ELEMENT(mVideoAppSink), "sink");
int PARNumerator, PARDenominator;
#if GST_VERSION_MAJOR >= 1
GstCaps* caps = gst_pad_get_current_caps(sinkpad);
memset (&mVideoInfo, 0, sizeof (mVideoInfo));
gst_video_info_from_caps(&mVideoInfo, caps);
mFormat = mVideoInfo.finfo->format;
mPicture.width = mVideoInfo.width;
@@ -1121,17 +1121,17 @@ void GStreamerReader::VideoPreroll()
ScaleDisplayByAspectRatio(displaySize, float(PARNumerator) / float(PARDenominator));
// If video frame size is overflow, stop playing.
if (IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
GstStructure* structure = gst_caps_get_structure(caps, 0);
gst_structure_get_fraction(structure, "framerate", &fpsNum, &fpsDen);
mInfo.mVideo.mDisplay = displaySize;
} else {
- LOG(PR_LOG_DEBUG, "invalid video region");
+ LOG(LogLevel::Debug, "invalid video region");
Eos();
}
gst_caps_unref(caps);
gst_object_unref(sinkpad);
}
GstFlowReturn GStreamerReader::NewBufferCb(GstAppSink* aSink,
gpointer aUserData)
@@ -1355,17 +1355,17 @@ GstPadProbeReturn GStreamerReader::Event
GstEvent *aEvent = (GstEvent *)aInfo->data;
return reader->EventProbe(aPad, aEvent);
}
GstPadProbeReturn GStreamerReader::EventProbe(GstPad *aPad, GstEvent *aEvent)
{
GstElement* parent = GST_ELEMENT(gst_pad_get_parent(aPad));
- LOG(PR_LOG_DEBUG, "event probe %s", GST_EVENT_TYPE_NAME (aEvent));
+ LOG(LogLevel::Debug, "event probe %s", GST_EVENT_TYPE_NAME (aEvent));
switch(GST_EVENT_TYPE(aEvent)) {
case GST_EVENT_SEGMENT:
{
const GstSegment *newSegment;
GstSegment* segment;
/* Store the segments so we can convert timestamps to stream time, which
--- a/dom/media/imagecapture/ImageCapture.h
+++ b/dom/media/imagecapture/ImageCapture.h
@@ -10,17 +10,17 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/ImageCaptureBinding.h"
#include "mozilla/Logging.h"
namespace mozilla {
#ifndef IC_LOG
PRLogModuleInfo* GetICLog();
-#define IC_LOG(...) MOZ_LOG(GetICLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define IC_LOG(...) MOZ_LOG(GetICLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#endif
namespace dom {
class Blob;
class VideoStreamTrack;
/**
--- a/dom/media/mediasource/ContainerParser.cpp
+++ b/dom/media/mediasource/ContainerParser.cpp
@@ -21,17 +21,17 @@ extern PRLogModuleInfo* GetMediaSourceLo
/* Polyfill __func__ on MSVC to pass to the log. */
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
-#define MSE_DEBUG(name, arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(name, arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
namespace mozilla {
ContainerParser::ContainerParser(const nsACString& aType)
: mHasInitData(false)
, mType(aType)
{
}
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -52,18 +52,18 @@ PRLogModuleInfo* GetMediaSourceAPILog()
{
static PRLogModuleInfo* sLogModule;
if (!sLogModule) {
sLogModule = PR_NewLogModule("MediaSource");
}
return sLogModule;
}
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), PR_LOG_DEBUG, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
// Arbitrary limit.
static const unsigned int MAX_SOURCE_BUFFERS = 16;
namespace mozilla {
static const char* const gMediaSourceTypes[6] = {
"video/mp4",
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -12,18 +12,18 @@
#include "MediaSourceReader.h"
#include "MediaSourceResource.h"
#include "MediaSourceUtils.h"
#include "SourceBufferDecoder.h"
#include "VideoUtils.h"
extern PRLogModuleInfo* GetMediaSourceLog();
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_VERBOSE, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
namespace mozilla {
class SourceBufferDecoder;
MediaSourceDecoder::MediaSourceDecoder(dom::HTMLMediaElement* aElement)
: mMediaSource(nullptr)
, mMediaSourceDuration(UnspecifiedNaN<double>())
--- a/dom/media/mediasource/MediaSourceReader.cpp
+++ b/dom/media/mediasource/MediaSourceReader.cpp
@@ -20,18 +20,18 @@
#include "SharedDecoderManager.h"
#include "MP4Decoder.h"
#include "MP4Demuxer.h"
#include "MP4Reader.h"
#endif
extern PRLogModuleInfo* GetMediaSourceLog();
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_VERBOSE, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
// When a stream hits EOS it needs to decide what other stream to switch to. Due
// to inaccuracies is determining buffer end frames (Bug 1065207) and rounding
// issues we use a fuzz factor to determine the end time of this stream for
// switching to the new stream. This value is based on the end of frame
// default value used in Blink, kDefaultBufferDurationInMs.
#define EOS_FUZZ_US 125000
--- a/dom/media/mediasource/MediaSourceResource.h
+++ b/dom/media/mediasource/MediaSourceResource.h
@@ -8,17 +8,17 @@
#define MOZILLA_MEDIASOURCERESOURCE_H_
#include "MediaResource.h"
#include "mozilla/Monitor.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetMediaSourceLog();
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
#define UNIMPLEMENTED() MSE_DEBUG("UNIMPLEMENTED FUNCTION at %s:%d", __FILE__, __LINE__)
namespace mozilla {
class MediaSourceResource final : public MediaResource
{
public:
--- a/dom/media/mediasource/ResourceQueue.cpp
+++ b/dom/media/mediasource/ResourceQueue.cpp
@@ -10,18 +10,18 @@
extern PRLogModuleInfo* GetSourceBufferResourceLog();
/* Polyfill __func__ on MSVC to pass to the log. */
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
-#define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), PR_LOG_DEBUG, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), PR_LOG_VERBOSE, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Debug, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Verbose, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
namespace mozilla {
ResourceItem::ResourceItem(MediaLargeByteBuffer* aData)
: mData(aData)
{
}
--- a/dom/media/mediasource/SourceBuffer.cpp
+++ b/dom/media/mediasource/SourceBuffer.cpp
@@ -24,19 +24,19 @@
#include "TimeUnits.h"
struct JSContext;
class JSObject;
extern PRLogModuleInfo* GetMediaSourceLog();
extern PRLogModuleInfo* GetMediaSourceAPILog();
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
-#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_VERBOSE, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
-#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), PR_LOG_DEBUG, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
namespace mozilla {
namespace dom {
class AppendDataRunnable : public nsRunnable {
public:
AppendDataRunnable(SourceBuffer* aSourceBuffer,
--- a/dom/media/mediasource/SourceBufferDecoder.cpp
+++ b/dom/media/mediasource/SourceBufferDecoder.cpp
@@ -11,17 +11,17 @@
#include "MediaDecoderReader.h"
extern PRLogModuleInfo* GetMediaSourceLog();
/* Polyfill __func__ on MSVC to pass to the log. */
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("SourceBufferDecoder(%p:%s)::%s: " arg, this, mResource->GetContentType().get(), __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferDecoder(%p:%s)::%s: " arg, this, mResource->GetContentType().get(), __func__, ##__VA_ARGS__))
namespace mozilla {
class ReentrantMonitor;
namespace layers {
class ImageContainer;
--- a/dom/media/mediasource/SourceBufferList.cpp
+++ b/dom/media/mediasource/SourceBufferList.cpp
@@ -14,18 +14,18 @@
#include "nsIRunnable.h"
#include "nsString.h"
#include "nsThreadUtils.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetMediaSourceLog();
extern PRLogModuleInfo* GetMediaSourceAPILog();
-#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), PR_LOG_DEBUG, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
struct JSContext;
class JSObject;
namespace mozilla {
namespace dom {
--- a/dom/media/mediasource/SourceBufferResource.cpp
+++ b/dom/media/mediasource/SourceBufferResource.cpp
@@ -17,18 +17,18 @@ PRLogModuleInfo* GetSourceBufferResource
{
static PRLogModuleInfo* sLogModule;
if (!sLogModule) {
sLogModule = PR_NewLogModule("SourceBufferResource");
}
return sLogModule;
}
-#define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), PR_LOG_DEBUG, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
-#define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), PR_LOG_VERBOSE, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Debug, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Verbose, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
namespace mozilla {
nsresult
SourceBufferResource::Close()
{
ReentrantMonitorAutoEnter mon(mMonitor);
SBR_DEBUG("Close");
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -19,17 +19,17 @@
#include "mozilla/TypeTraits.h"
#include "nsError.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetMediaSourceLog();
-#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("TrackBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
+#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("TrackBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
// Time in seconds to substract from the current time when deciding the
// time point to evict data before in a decoder. This is used to help
// prevent evicting the current playback point.
#define MSE_EVICT_THRESHOLD_TIME 2.0
// Time in microsecond under which a timestamp will be considered to be 0.
#define FUZZ_TIMESTAMP_OFFSET 100000
--- a/dom/media/ogg/OggCodecState.cpp
+++ b/dom/media/ogg/OggCodecState.cpp
@@ -112,28 +112,28 @@ bool OggCodecState::IsValidVorbisTagName
}
bool OggCodecState::AddVorbisComment(MetadataTags* aTags,
const char* aComment,
uint32_t aLength)
{
const char* div = (const char*)memchr(aComment, '=', aLength);
if (!div) {
- LOG(PR_LOG_DEBUG, ("Skipping comment: no separator"));
+ LOG(LogLevel::Debug, ("Skipping comment: no separator"));
return false;
}
nsCString key = nsCString(aComment, div-aComment);
if (!IsValidVorbisTagName(key)) {
- LOG(PR_LOG_DEBUG, ("Skipping comment: invalid tag name"));
+ LOG(LogLevel::Debug, ("Skipping comment: invalid tag name"));
return false;
}
uint32_t valueLength = aLength - (div-aComment);
nsCString value = nsCString(div + 1, valueLength);
if (!IsUTF8(value)) {
- LOG(PR_LOG_DEBUG, ("Skipping comment: invalid UTF-8 in value"));
+ LOG(LogLevel::Debug, ("Skipping comment: invalid UTF-8 in value"));
return false;
}
aTags->Put(key, value);
return true;
}
void VorbisState::RecordVorbisPacketSamples(ogg_packet* aPacket,
long aSamples)
@@ -830,17 +830,17 @@ nsresult OpusState::Reset(bool aStart)
mPrevPacketGranulepos = aStart ? 0 : -1;
}
// Clear queued data.
if (NS_FAILED(OggCodecState::Reset())) {
return NS_ERROR_FAILURE;
}
- LOG(PR_LOG_DEBUG, ("Opus decoder reset, to skip %d", mSkip));
+ LOG(LogLevel::Debug, ("Opus decoder reset, to skip %d", mSkip));
return res;
}
bool OpusState::Init(void)
{
if (!mActive)
return false;
@@ -853,17 +853,17 @@ bool OpusState::Init(void)
mParser->mChannels,
mParser->mStreams,
mParser->mCoupledStreams,
mParser->mMappingTable,
&error);
mSkip = mParser->mPreSkip;
- LOG(PR_LOG_DEBUG, ("Opus decoder init, to skip %d", mSkip));
+ LOG(LogLevel::Debug, ("Opus decoder init, to skip %d", mSkip));
return error == OPUS_OK;
}
bool OpusState::DecodeHeader(ogg_packet* aPacket)
{
nsAutoRef<ogg_packet> autoRelease(aPacket);
switch(mPacketCount++) {
@@ -1182,17 +1182,17 @@ bool SkeletonState::DecodeIndex(ogg_pack
uint32_t serialno = LittleEndian::readUint32(aPacket->packet + INDEX_SERIALNO_OFFSET);
int64_t numKeyPoints = LittleEndian::readInt64(aPacket->packet + INDEX_NUM_KEYPOINTS_OFFSET);
int64_t endTime = 0, startTime = 0;
const unsigned char* p = aPacket->packet;
int64_t timeDenom = LittleEndian::readInt64(aPacket->packet + INDEX_TIME_DENOM_OFFSET);
if (timeDenom == 0) {
- LOG(PR_LOG_DEBUG, ("Ogg Skeleton Index packet for stream %u has 0 "
+ LOG(LogLevel::Debug, ("Ogg Skeleton Index packet for stream %u has 0 "
"timestamp denominator.", serialno));
return (mActive = false);
}
// Extract the start time.
int64_t timeRawInt = LittleEndian::readInt64(p + INDEX_FIRST_NUMER_OFFSET);
CheckedInt64 t = CheckedInt64(timeRawInt) * USECS_PER_S;
if (!t.isValid()) {
@@ -1225,17 +1225,17 @@ bool SkeletonState::DecodeIndex(ogg_pack
numKeyPoints < 0)
{
// Packet size is less than the theoretical minimum size, or the packet is
// claiming to store more keypoints than it's capable of storing. This means
// that the numKeyPoints field is too large or small for the packet to
// possibly contain as many packets as it claims to, so the numKeyPoints
// field is possibly malicious. Don't try decoding this index, we may run
// out of memory.
- LOG(PR_LOG_DEBUG, ("Possibly malicious number of key points reported "
+ LOG(LogLevel::Debug, ("Possibly malicious number of key points reported "
"(%lld) in index packet for stream %u.",
numKeyPoints,
serialno));
return (mActive = false);
}
nsAutoPtr<nsKeyFrameIndex> keyPoints(new nsKeyFrameIndex(startTime, endTime));
@@ -1273,17 +1273,17 @@ bool SkeletonState::DecodeIndex(ogg_pack
numKeyPointsRead++;
}
int32_t keyPointsRead = keyPoints->Length();
if (keyPointsRead > 0) {
mIndex.Put(serialno, keyPoints.forget());
}
- LOG(PR_LOG_DEBUG, ("Loaded %d keypoints for Skeleton on stream %u",
+ LOG(LogLevel::Debug, ("Loaded %d keypoints for Skeleton on stream %u",
keyPointsRead, serialno));
return true;
}
nsresult SkeletonState::IndexedSeekTargetForTrack(uint32_t aSerialno,
int64_t aTarget,
nsKeyPoint& aResult)
{
@@ -1337,17 +1337,17 @@ nsresult SkeletonState::IndexedSeekTarge
{
r.mKeyPoint = k;
r.mSerial = aTracks[i];
}
}
if (r.IsNull()) {
return NS_ERROR_FAILURE;
}
- LOG(PR_LOG_DEBUG, ("Indexed seek target for time %lld is offset %lld",
+ LOG(LogLevel::Debug, ("Indexed seek target for time %lld is offset %lld",
aTarget, r.mKeyPoint.mOffset));
aResult = r;
return NS_OK;
}
nsresult SkeletonState::GetDuration(const nsTArray<uint32_t>& aTracks,
int64_t& aDuration)
{
@@ -1477,17 +1477,17 @@ bool SkeletonState::DecodeHeader(ogg_pac
if (mVersion < SKELETON_VERSION(4,0) ||
mVersion >= SKELETON_VERSION(5,0) ||
aPacket->bytes < SKELETON_4_0_MIN_HEADER_LEN)
return false;
// Extract the segment length.
mLength = LittleEndian::readInt64(aPacket->packet + SKELETON_FILE_LENGTH_OFFSET);
- LOG(PR_LOG_DEBUG, ("Skeleton segment length: %lld", mLength));
+ LOG(LogLevel::Debug, ("Skeleton segment length: %lld", mLength));
// Initialize the serialno-to-index map.
return true;
} else if (IsSkeletonIndex(aPacket) && mVersion >= SKELETON_VERSION(4,0)) {
return DecodeIndex(aPacket);
} else if (IsSkeletonFisbone(aPacket)) {
return DecodeFisbone(aPacket);
} else if (aPacket->e_o_s) {
--- a/dom/media/ogg/OggReader.cpp
+++ b/dom/media/ogg/OggReader.cpp
@@ -286,17 +286,17 @@ void OggReader::SetupTargetSkeleton(Skel
// Extract the duration info out of the index, so we don't need to seek to
// the end of resource to get it.
nsAutoTArray<uint32_t, 2> tracks;
BuildSerialList(tracks);
int64_t duration = 0;
if (NS_SUCCEEDED(aSkeletonState->GetDuration(tracks, duration))) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
- LOG(PR_LOG_DEBUG, ("Got duration from Skeleton index %lld", duration));
+ LOG(LogLevel::Debug, ("Got duration from Skeleton index %lld", duration));
}
}
}
}
void OggReader::SetupMediaTracksInfo(const nsTArray<uint32_t>& aSerials)
{
// For each serial number
@@ -487,17 +487,17 @@ nsresult OggReader::ReadMetadata(MediaIn
int64_t endTime = 0;
{
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
endTime = RangeEndTime(length);
}
if (endTime != -1) {
mDecoder->SetMediaEndTime(endTime);
- LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime));
+ LOG(LogLevel::Debug, ("Got Ogg duration from seeking to end %lld", endTime));
}
}
} else {
return NS_ERROR_FAILURE;
}
*aInfo = mInfo;
return NS_OK;
@@ -608,32 +608,32 @@ nsresult OggReader::DecodeOpus(ogg_packe
}
// Trim the initial frames while the decoder is settling.
if (mOpusState->mSkip > 0) {
int32_t skipFrames = std::min(mOpusState->mSkip, frames);
if (skipFrames == frames) {
// discard the whole packet
mOpusState->mSkip -= frames;
- LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d frames"
+ LOG(LogLevel::Debug, ("Opus decoder skipping %d frames"
" (whole packet)", frames));
return NS_OK;
}
int32_t keepFrames = frames - skipFrames;
int samples = keepFrames * channels;
nsAutoArrayPtr<AudioDataValue> trimBuffer(new AudioDataValue[samples]);
for (int i = 0; i < samples; i++)
trimBuffer[i] = buffer[skipFrames*channels + i];
startFrame = endFrame - keepFrames;
frames = keepFrames;
buffer = trimBuffer;
mOpusState->mSkip -= skipFrames;
- LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d frames", skipFrames));
+ LOG(LogLevel::Debug, ("Opus decoder skipping %d frames", skipFrames));
}
// Save this packet's granule position in case we need to perform end
// trimming on the next packet.
mOpusState->mPrevPacketGranulepos = endFrame;
// Apply the header gain if one was specified.
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
if (mOpusState->mGain != 1.0f) {
@@ -654,17 +654,17 @@ nsresult OggReader::DecodeOpus(ogg_packe
}
#endif
// No channel mapping for more than 8 channels.
if (channels > 8) {
return NS_ERROR_FAILURE;
}
- LOG(PR_LOG_DEBUG, ("Opus decoder pushing %d frames", frames));
+ LOG(LogLevel::Debug, ("Opus decoder pushing %d frames", frames));
int64_t startTime = mOpusState->Time(startFrame);
int64_t endTime = mOpusState->Time(endFrame);
mAudioQueue.Push(new AudioData(mDecoder->GetResource()->Tell(),
startTime,
endTime - startTime,
frames,
buffer.forget(),
channels,
@@ -782,17 +782,17 @@ bool OggReader::ReadOggChain()
mSkeletonState->mMsgFieldStore.Get(serial, &msgInfo);
}
if ((newVorbisState && ReadHeaders(newVorbisState)) &&
(mVorbisState->mInfo.rate == newVorbisState->mInfo.rate) &&
(mVorbisState->mInfo.channels == newVorbisState->mInfo.channels)) {
SetupTargetVorbis(newVorbisState);
- LOG(PR_LOG_DEBUG, ("New vorbis ogg link, serial=%d\n", mVorbisSerial));
+ LOG(LogLevel::Debug, ("New vorbis ogg link, serial=%d\n", mVorbisSerial));
if (msgInfo) {
InitTrack(TrackInfo::kAudioTrack, msgInfo, &mInfo.mAudio, true);
}
mInfo.mAudio.mRate = newVorbisState->mInfo.rate;
mInfo.mAudio.mChannels = newVorbisState->mInfo.channels;
chained = true;
@@ -1287,17 +1287,17 @@ OggReader::IndexedSeekResult OggReader::
// Seek to the keypoint returned by the index.
if (keyframe.mKeyPoint.mOffset > resource->GetLength() ||
keyframe.mKeyPoint.mOffset < 0)
{
// Index must be invalid.
return RollbackIndexedSeek(tell);
}
- LOG(PR_LOG_DEBUG, ("Seeking using index to keyframe at offset %lld\n",
+ LOG(LogLevel::Debug, ("Seeking using index to keyframe at offset %lld\n",
keyframe.mKeyPoint.mOffset));
nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET,
keyframe.mKeyPoint.mOffset);
NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR);
// We've moved the read set, so reset decode.
res = ResetDecode();
NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR);
@@ -1310,17 +1310,17 @@ OggReader::IndexedSeekResult OggReader::
&mOggState,
false,
keyframe.mKeyPoint.mOffset,
resource->GetLength(),
&page,
skippedBytes);
NS_ENSURE_TRUE(syncres != PAGE_SYNC_ERROR, SEEK_FATAL_ERROR);
if (syncres != PAGE_SYNC_OK || skippedBytes != 0) {
- LOG(PR_LOG_DEBUG, ("Indexed-seek failure: Ogg Skeleton Index is invalid "
+ LOG(LogLevel::Debug, ("Indexed-seek failure: Ogg Skeleton Index is invalid "
"or sync error after seek"));
return RollbackIndexedSeek(tell);
}
uint32_t serial = ogg_page_serialno(&page);
if (serial != keyframe.mSerial) {
// Serialno of page at offset isn't what the index told us to expect.
// Assume the index is invalid.
return RollbackIndexedSeek(tell);
@@ -1339,17 +1339,17 @@ OggReader::IndexedSeekResult OggReader::
nsresult OggReader::SeekInBufferedRange(int64_t aTarget,
int64_t aAdjustedTarget,
int64_t aStartTime,
int64_t aEndTime,
const nsTArray<SeekRange>& aRanges,
const SeekRange& aRange)
{
- LOG(PR_LOG_DEBUG, ("%p Seeking in buffered data to %lld using bisection search", mDecoder, aTarget));
+ LOG(LogLevel::Debug, ("%p Seeking in buffered data to %lld using bisection search", mDecoder, aTarget));
nsresult res = NS_OK;
if (HasVideo() || aAdjustedTarget >= aTarget) {
// We know the exact byte range in which the target must lie. It must
// be buffered in the media cache. Seek there.
nsresult res = SeekBisection(aTarget, aRange, 0);
if (NS_FAILED(res) || !HasVideo()) {
return res;
}
@@ -1372,17 +1372,17 @@ nsresult OggReader::SeekInBufferedRange(
VideoData* video = mVideoQueue.PeekFront();
if (video && !video->mKeyframe) {
// First decoded frame isn't a keyframe, seek back to previous keyframe,
// otherwise we'll get visual artifacts.
NS_ASSERTION(video->mTimecode != -1, "Must have a granulepos");
int shift = mTheoraState->mInfo.keyframe_granule_shift;
int64_t keyframeGranulepos = (video->mTimecode >> shift) << shift;
int64_t keyframeTime = mTheoraState->StartTime(keyframeGranulepos);
- SEEK_LOG(PR_LOG_DEBUG, ("Keyframe for %lld is at %lld, seeking back to it",
+ SEEK_LOG(LogLevel::Debug, ("Keyframe for %lld is at %lld, seeking back to it",
video->mTime, keyframeTime));
aAdjustedTarget = std::min(aAdjustedTarget, keyframeTime);
}
}
if (aAdjustedTarget < aTarget) {
SeekRange k = SelectSeekRange(aRanges,
aAdjustedTarget,
aStartTime,
@@ -1393,17 +1393,17 @@ nsresult OggReader::SeekInBufferedRange(
return res;
}
nsresult OggReader::SeekInUnbuffered(int64_t aTarget,
int64_t aStartTime,
int64_t aEndTime,
const nsTArray<SeekRange>& aRanges)
{
- LOG(PR_LOG_DEBUG, ("%p Seeking in unbuffered data to %lld using bisection search", mDecoder, aTarget));
+ LOG(LogLevel::Debug, ("%p Seeking in unbuffered data to %lld using bisection search", mDecoder, aTarget));
// If we've got an active Theora bitstream, determine the maximum possible
// time in usecs which a keyframe could be before a given interframe. We
// subtract this from our seek target, seek to the new target, and then
// will decode forward to the original seek target. We should encounter a
// keyframe in that interval. This prevents us from needing to run two
// bisections; one for the seek target frame, and another to find its
// keyframe. It's usually faster to just download this extra data, rather
@@ -1438,17 +1438,17 @@ OggReader::Seek(int64_t aTarget, int64_t
}
}
nsresult OggReader::SeekInternal(int64_t aTarget, int64_t aEndTime)
{
MOZ_ASSERT(OnTaskQueue());
if (mIsChained)
return NS_ERROR_FAILURE;
- LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
+ LOG(LogLevel::Debug, ("%p About to seek to %lld", mDecoder, aTarget));
nsresult res;
MediaResource* resource = mDecoder->GetResource();
NS_ENSURE_TRUE(resource != nullptr, NS_ERROR_FAILURE);
int64_t adjustedTarget = aTarget;
if (HasAudio() && mOpusState){
adjustedTarget = std::max(mStartTime, aTarget - SEEK_OPUS_PREROLL);
}
@@ -1652,32 +1652,32 @@ nsresult OggReader::SeekBisection(int64_
return NS_ERROR_FAILURE;
}
interval = endOffset - startOffset - startLength;
if (interval == 0) {
// Our interval is empty, we've found the optimal seek point, as the
// page at the start offset is before the seek target, and the page
// at the end offset is after the seek target.
- SEEK_LOG(PR_LOG_DEBUG, ("Interval narrowed, terminating bisection."));
+ SEEK_LOG(LogLevel::Debug, ("Interval narrowed, terminating bisection."));
break;
}
// Guess bisection point.
duration = endTime - startTime;
target = (double)(seekTarget - startTime) / (double)duration;
guess = startOffset + startLength +
static_cast<ogg_int64_t>((double)interval * target);
guess = std::min(guess, endOffset - PAGE_STEP);
if (mustBackoff) {
// We previously failed to determine the time at the guess offset,
// probably because we ran out of data to decode. This usually happens
// when we guess very close to the end offset. So reduce the guess
// offset using an exponential backoff until we determine the time.
- SEEK_LOG(PR_LOG_DEBUG, ("Backing off %d bytes, backsteps=%d",
+ SEEK_LOG(LogLevel::Debug, ("Backing off %d bytes, backsteps=%d",
static_cast<int32_t>(PAGE_STEP * pow(2.0, backsteps)), backsteps));
guess -= PAGE_STEP * static_cast<ogg_int64_t>(pow(2.0, backsteps));
if (guess <= startOffset) {
// We've tried to backoff to before the start offset of our seek
// range. This means we couldn't find a seek termination position
// near the end of the seek range, so just set the seek termination
// condition, and break out of the bisection loop. We'll begin
@@ -1690,17 +1690,17 @@ nsresult OggReader::SeekBisection(int64_
// We reset mustBackoff. If we still need to backoff further, it will
// be set to true again.
mustBackoff = false;
} else {
backsteps = 0;
}
guess = std::max(guess, startOffset + startLength);
- SEEK_LOG(PR_LOG_DEBUG, ("Seek loop start[o=%lld..%lld t=%lld] "
+ SEEK_LOG(LogLevel::Debug, ("Seek loop start[o=%lld..%lld t=%lld] "
"end[o=%lld t=%lld] "
"interval=%lld target=%lf guess=%lld",
startOffset, (startOffset+startLength), startTime,
endOffset, endTime, interval, target, guess));
NS_ASSERTION(guess >= startOffset + startLength, "Guess must be after range start");
NS_ASSERTION(guess < endOffset, "Guess must be before range end");
NS_ASSERTION(guess != previousGuess, "Guess should be different to previous");
@@ -1720,17 +1720,17 @@ nsresult OggReader::SeekBisection(int64_
skippedBytes);
NS_ENSURE_TRUE(res != PAGE_SYNC_ERROR, NS_ERROR_FAILURE);
if (res == PAGE_SYNC_END_OF_RANGE) {
// Our guess was too close to the end, we've ended up reading the end
// page. Backoff exponentially from the end point, in case the last
// page/frame/sample is huge.
mustBackoff = true;
- SEEK_LOG(PR_LOG_DEBUG, ("Hit the end of range, backing off"));
+ SEEK_LOG(LogLevel::Debug, ("Hit the end of range, backing off"));
continue;
}
// We've located a page of length |ret| at |guess + skippedBytes|.
// Remember where the page is located.
pageOffset = guess + skippedBytes;
pageLength = page.header_len + page.body_len;
@@ -1803,35 +1803,35 @@ nsresult OggReader::SeekBisection(int64_
granuleTime = std::max(audioTime, videoTime);
NS_ASSERTION(granuleTime > 0, "Must get a granuletime");
break;
} // End of "until we determine time at guess offset" loop.
if (interval == 0) {
// Seek termination condition; we've found the page boundary of the
// last page before the target, and the first page after the target.
- SEEK_LOG(PR_LOG_DEBUG, ("Terminating seek at offset=%lld", startOffset));
+ SEEK_LOG(LogLevel::Debug, ("Terminating seek at offset=%lld", startOffset));
NS_ASSERTION(startTime < aTarget, "Start time must always be less than target");
res = resource->Seek(nsISeekableStream::NS_SEEK_SET, startOffset);
NS_ENSURE_SUCCESS(res,res);
if (NS_FAILED(ResetDecode())) {
return NS_ERROR_FAILURE;
}
break;
}
- SEEK_LOG(PR_LOG_DEBUG, ("Time at offset %lld is %lld", guess, granuleTime));
+ SEEK_LOG(LogLevel::Debug, ("Time at offset %lld is %lld", guess, granuleTime));
if (granuleTime < seekTarget && granuleTime > seekLowerBound) {
// We're within the fuzzy region in which we want to terminate the search.
res = resource->Seek(nsISeekableStream::NS_SEEK_SET, pageOffset);
NS_ENSURE_SUCCESS(res,res);
if (NS_FAILED(ResetDecode())) {
return NS_ERROR_FAILURE;
}
- SEEK_LOG(PR_LOG_DEBUG, ("Terminating seek at offset=%lld", pageOffset));
+ SEEK_LOG(LogLevel::Debug, ("Terminating seek at offset=%lld", pageOffset));
break;
}
if (granuleTime >= seekTarget) {
// We've landed after the seek target.
NS_ASSERTION(pageOffset < endOffset, "offset_end must decrease");
endOffset = pageOffset;
endTime = granuleTime;
@@ -1842,17 +1842,17 @@ nsresult OggReader::SeekBisection(int64_
startOffset = pageOffset;
startLength = pageLength;
startTime = granuleTime;
}
NS_ASSERTION(startTime < seekTarget, "Must be before seek target");
NS_ASSERTION(endTime >= seekTarget, "End must be after seek target");
}
- SEEK_LOG(PR_LOG_DEBUG, ("Seek complete in %d bisections.", hops));
+ SEEK_LOG(LogLevel::Debug, ("Seek complete in %d bisections.", hops));
return NS_OK;
}
media::TimeIntervals OggReader::GetBuffered()
{
MOZ_ASSERT(mStartTime != -1, "Need to finish metadata decode first");
{
@@ -1979,24 +1979,24 @@ VideoData* OggReader::FindStartTime(int6
int64_t videoStartTime = INT64_MAX;
int64_t audioStartTime = INT64_MAX;
VideoData* videoData = nullptr;
if (HasVideo()) {
videoData = DecodeToFirstVideoData();
if (videoData) {
videoStartTime = videoData->mTime;
- LOG(PR_LOG_DEBUG, ("OggReader::FindStartTime() video=%lld", videoStartTime));
+ LOG(LogLevel::Debug, ("OggReader::FindStartTime() video=%lld", videoStartTime));
}
}
if (HasAudio()) {
AudioData* audioData = DecodeToFirstAudioData();
if (audioData) {
audioStartTime = audioData->mTime;
- LOG(PR_LOG_DEBUG, ("OggReader::FindStartTime() audio=%lld", audioStartTime));
+ LOG(LogLevel::Debug, ("OggReader::FindStartTime() audio=%lld", audioStartTime));
}
}
int64_t startTime = std::min(videoStartTime, audioStartTime);
if (startTime != INT64_MAX) {
aOutStartTime = startTime;
}
--- a/dom/media/ogg/OpusParser.cpp
+++ b/dom/media/ogg/OpusParser.cpp
@@ -40,32 +40,32 @@ OpusParser::OpusParser():
mChannelMapping(0),
mStreams(0),
mCoupledStreams(0)
{ }
bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength)
{
if (aLength < 19 || memcmp(aData, "OpusHead", 8)) {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: unrecognized header"));
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: unrecognized header"));
return false;
}
mRate = 48000; // The Opus decoder runs at 48 kHz regardless.
int version = aData[8];
// Accept file format versions 0.x.
if ((version & 0xf0) != 0) {
- OPUS_LOG(PR_LOG_DEBUG, ("Rejecting unknown Opus file version %d", version));
+ OPUS_LOG(LogLevel::Debug, ("Rejecting unknown Opus file version %d", version));
return false;
}
mChannels = aData[9];
if (mChannels<1) {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: Number of channels %d", mChannels));
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: Number of channels %d", mChannels));
return false;
}
mPreSkip = LittleEndian::readUint16(aData + 10);
mNominalRate = LittleEndian::readUint32(aData + 12);
double gain_dB = LittleEndian::readInt16(aData + 16) / 256.0;
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
mGain = static_cast<float>(pow(10,0.05*gain_dB));
@@ -73,66 +73,66 @@ bool OpusParser::DecodeHeader(unsigned c
mGain_Q16 = static_cast<int32_t>(std::min(65536*pow(10,0.05*gain_dB)+0.5,
static_cast<double>(INT32_MAX)));
#endif
mChannelMapping = aData[18];
if (mChannelMapping == 0) {
// Mapping family 0 only allows two channels
if (mChannels>2) {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for"
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: too many channels (%d) for"
" mapping family 0.", mChannels));
return false;
}
mStreams = 1;
mCoupledStreams = mChannels - 1;
mMappingTable[0] = 0;
mMappingTable[1] = 1;
} else if (mChannelMapping == 1) {
// Currently only up to 8 channels are defined for mapping family 1
if (mChannels>8) {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for"
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: too many channels (%d) for"
" mapping family 1.", mChannels));
return false;
}
if (aLength>static_cast<unsigned>(20+mChannels)) {
mStreams = aData[19];
mCoupledStreams = aData[20];
int i;
for (i=0; i<mChannels; i++)
mMappingTable[i] = aData[21+i];
} else {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: channel mapping %d,"
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: channel mapping %d,"
" but no channel mapping table", mChannelMapping));
return false;
}
} else {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: unsupported channel mapping "
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: unsupported channel mapping "
"family %d", mChannelMapping));
return false;
}
if (mStreams < 1) {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: no streams"));
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: no streams"));
return false;
}
if (mCoupledStreams > mStreams) {
- OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: more coupled streams (%d) than "
+ OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: more coupled streams (%d) than "
"total streams (%d)", mCoupledStreams, mStreams));
return false;
}
#ifdef DEBUG
- OPUS_LOG(PR_LOG_DEBUG, ("Opus stream header:"));
- OPUS_LOG(PR_LOG_DEBUG, (" channels: %d", mChannels));
- OPUS_LOG(PR_LOG_DEBUG, (" preskip: %d", mPreSkip));
- OPUS_LOG(PR_LOG_DEBUG, (" original: %d Hz", mNominalRate));
- OPUS_LOG(PR_LOG_DEBUG, (" gain: %.2f dB", gain_dB));
- OPUS_LOG(PR_LOG_DEBUG, ("Channel Mapping:"));
- OPUS_LOG(PR_LOG_DEBUG, (" family: %d", mChannelMapping));
- OPUS_LOG(PR_LOG_DEBUG, (" streams: %d", mStreams));
+ OPUS_LOG(LogLevel::Debug, ("Opus stream header:"));
+ OPUS_LOG(LogLevel::Debug, (" channels: %d", mChannels));
+ OPUS_LOG(LogLevel::Debug, (" preskip: %d", mPreSkip));
+ OPUS_LOG(LogLevel::Debug, (" original: %d Hz", mNominalRate));
+ OPUS_LOG(LogLevel::Debug, (" gain: %.2f dB", gain_dB));
+ OPUS_LOG(LogLevel::Debug, ("Channel Mapping:"));
+ OPUS_LOG(LogLevel::Debug, (" family: %d", mChannelMapping));
+ OPUS_LOG(LogLevel::Debug, (" streams: %d", mStreams));
#endif
return true;
}
bool OpusParser::DecodeTags(unsigned char* aData, size_t aLength)
{
if (aLength < 16 || memcmp(aData, "OpusTags", 8))
return false;
@@ -175,19 +175,19 @@ bool OpusParser::DecodeTags(unsigned cha
if (len > bytes)
return false;
mTags.AppendElement(nsCString(reinterpret_cast<const char*>(buf), len));
buf += len;
bytes -= len;
}
#ifdef DEBUG
- OPUS_LOG(PR_LOG_DEBUG, ("Opus metadata header:"));
- OPUS_LOG(PR_LOG_DEBUG, (" vendor: %s", mVendorString.get()));
+ OPUS_LOG(LogLevel::Debug, ("Opus metadata header:"));
+ OPUS_LOG(LogLevel::Debug, (" vendor: %s", mVendorString.get()));
for (uint32_t i = 0; i < mTags.Length(); i++) {
- OPUS_LOG(PR_LOG_DEBUG, (" %s", mTags[i].get()));
+ OPUS_LOG(LogLevel::Debug, (" %s", mTags[i].get()));
}
#endif
return true;
}
} // namespace mozilla
--- a/dom/media/omx/AudioOffloadPlayer.cpp
+++ b/dom/media/omx/AudioOffloadPlayer.cpp
@@ -130,31 +130,31 @@ status_t AudioOffloadPlayer::Start(bool
format->findInt32(kKeyBitRate, &avgBitRate);
format->findInt64(kKeyDuration, &durationUs);
if(!format->findInt32(kKeyChannelMask, &channelMask)) {
channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER;
}
if (mapMimeToAudioFormat(audioFormat, mime) != OK) {
- AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Couldn't map mime type \"%s\" to a valid "
+ AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Couldn't map mime type \"%s\" to a valid "
"AudioSystem::audio_format", mime));
audioFormat = AUDIO_FORMAT_INVALID;
}
offloadInfo.duration_us = durationUs;
offloadInfo.sample_rate = mSampleRate;
offloadInfo.channel_mask = channelMask;
offloadInfo.format = audioFormat;
offloadInfo.stream_type = AUDIO_STREAM_MUSIC;
offloadInfo.bit_rate = avgBitRate;
offloadInfo.has_video = false;
offloadInfo.is_streaming = false;
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("isOffloadSupported: SR=%u, CM=0x%x, "
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("isOffloadSupported: SR=%u, CM=0x%x, "
"Format=0x%x, StreamType=%d, BitRate=%u, duration=%lld us, has_video=%d",
offloadInfo.sample_rate, offloadInfo.channel_mask, offloadInfo.format,
offloadInfo.stream_type, offloadInfo.bit_rate, offloadInfo.duration_us,
offloadInfo.has_video));
err = mAudioSink->Open(mSampleRate,
numChannels,
channelMask,
@@ -205,17 +205,17 @@ status_t AudioOffloadPlayer::ChangeState
default:
break;
}
return OK;
}
static void ResetCallback(nsITimer* aTimer, void* aClosure)
{
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __FUNCTION__));
AudioOffloadPlayer* player = static_cast<AudioOffloadPlayer*>(aClosure);
if (player) {
player->Reset();
}
}
void AudioOffloadPlayer::Pause(bool aPlayPendingSamples)
{
@@ -286,17 +286,17 @@ void AudioOffloadPlayer::Reset()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mStarted) {
return;
}
CHECK(mAudioSink.get());
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("reset: mPlaying=%d mReachedEOS=%d",
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("reset: mPlaying=%d mReachedEOS=%d",
mPlaying, mReachedEOS));
mAudioSink->Stop();
// If we're closing and have reached EOS, we don't want to flush
// the track because if it is offloaded there could be a small
// amount of residual data in the hardware buffer which we must
// play to give gapless playback.
// But if we're resetting when paused or before we've reached EOS
@@ -308,17 +308,17 @@ void AudioOffloadPlayer::Reset()
mAudioSink->Flush();
}
mAudioSink->Close();
// Make sure to release any buffer we hold onto so that the
// source is able to stop().
if (mInputBuffer) {
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Releasing input buffer"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Releasing input buffer"));
mInputBuffer->release();
mInputBuffer = nullptr;
}
mSource->stop();
IPCThreadState::self()->flushCommands();
StopTimeUpdate();
@@ -344,17 +344,17 @@ nsRefPtr<MediaDecoder::SeekPromise> Audi
}
status_t AudioOffloadPlayer::DoSeek()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mSeekTarget.IsValid());
CHECK(mAudioSink.get());
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("DoSeek ( %lld )", mSeekTarget.mTime));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("DoSeek ( %lld )", mSeekTarget.mTime));
mReachedEOS = false;
mPositionTimeMediaUs = -1;
mStartPosUs = mSeekTarget.mTime;
if (!mSeekPromise.IsEmpty()) {
nsCOMPtr<nsIRunnable> nsEvent =
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
@@ -370,17 +370,17 @@ status_t AudioOffloadPlayer::DoSeek()
mAudioSink->Start();
} else {
if (mStarted) {
mAudioSink->Flush();
}
if (!mSeekPromise.IsEmpty()) {
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Fake seek complete during pause"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Fake seek complete during pause"));
// We do not reset mSeekTarget here.
MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility);
mSeekPromise.Resolve(val, __func__);
}
}
return OK;
}
@@ -463,33 +463,33 @@ size_t AudioOffloadPlayer::AudioSinkCall
void* aCookie,
GonkAudioSink::cb_event_t aEvent)
{
AudioOffloadPlayer* me = (AudioOffloadPlayer*) aCookie;
switch (aEvent) {
case GonkAudioSink::CB_EVENT_FILL_BUFFER:
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Audio position changed"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Notify Audio position changed"));
me->NotifyPositionChanged();
return me->FillBuffer(aBuffer, aSize);
case GonkAudioSink::CB_EVENT_STREAM_END:
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Audio EOS"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Notify Audio EOS"));
me->mReachedEOS = true;
me->NotifyAudioEOS();
break;
case GonkAudioSink::CB_EVENT_TEAR_DOWN:
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Tear down event"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Notify Tear down event"));
me->NotifyAudioTearDown();
break;
default:
- AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Unknown event %d from audio sink",
+ AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Unknown event %d from audio sink",
aEvent));
break;
}
return 0;
}
size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize)
{
@@ -527,30 +527,30 @@ size_t AudioOffloadPlayer::FillBuffer(vo
CHECK((!err && mInputBuffer) || (err && !mInputBuffer));
android::Mutex::Autolock autoLock(mLock);
if (err != OK) {
if (mSeekTarget.IsValid()) {
mSeekTarget.Reset();
}
- AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Error while reading media source %d "
+ AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Error while reading media source %d "
"Ok to receive EOS error at end", err));
if (!mReachedEOS) {
// After seek there is a possible race condition if
// OffloadThread is observing state_stopping_1 before
// framesReady() > 0. Ensure sink stop is called
// after last buffer is released. This ensures the
// partial buffer is written to the driver before
// stopping one is observed.The drawback is that
// there will be an unnecessary call to the parser
// after parser signalled EOS.
if (sizeDone > 0) {
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("send Partial buffer down"));
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("skip calling stop till next"
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("send Partial buffer down"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("skip calling stop till next"
" fillBuffer"));
break;
}
// no more buffers to push - stop() and wait for STREAM_END
// don't set mReachedEOS until stream end received
mAudioSink->Stop();
}
break;
@@ -560,31 +560,31 @@ size_t AudioOffloadPlayer::FillBuffer(vo
CHECK(mInputBuffer->meta_data()->findInt64(
kKeyTime, &mPositionTimeMediaUs));
}
if (mSeekTarget.IsValid() && seekTimeUs == mSeekTarget.mTime) {
MOZ_ASSERT(mSeekTarget.IsValid());
mSeekTarget.Reset();
if (!mSeekPromise.IsEmpty()) {
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("FillBuffer posting SEEK_COMPLETE"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("FillBuffer posting SEEK_COMPLETE"));
MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility);
mSeekPromise.Resolve(val, __func__);
}
} else if (mSeekTarget.IsValid()) {
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("seek is updated during unlocking mLock"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("seek is updated during unlocking mLock"));
}
if (refreshSeekTime) {
NotifyPositionChanged();
// need to adjust the mStartPosUs for offload decoding since parser
// might not be able to get the exact seek time requested.
mStartPosUs = mPositionTimeMediaUs;
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Adjust seek time to: %.2f",
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Adjust seek time to: %.2f",
mStartPosUs / 1E6));
}
}
if (mInputBuffer->range_length() == 0) {
mInputBuffer->release();
mInputBuffer = nullptr;
continue;
@@ -608,17 +608,17 @@ size_t AudioOffloadPlayer::FillBuffer(vo
return sizeDone;
}
void AudioOffloadPlayer::SetElementVisibility(bool aIsVisible)
{
MOZ_ASSERT(NS_IsMainThread());
mIsElementVisible = aIsVisible;
if (mIsElementVisible) {
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Element is visible. Start time update"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Element is visible. Start time update"));
StartTimeUpdate();
}
}
static void TimeUpdateCallback(nsITimer* aTimer, void* aClosure)
{
AudioOffloadPlayer* player = static_cast<AudioOffloadPlayer*>(aClosure);
player->TimeUpdate();
@@ -704,17 +704,17 @@ void AudioOffloadPlayer::SendMetaDataToH
}
if (aMeta->findInt32(kKeyEncoderDelay, &delaySamples)) {
param.addInt(String8(AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES), delaySamples);
}
if (aMeta->findInt32(kKeyEncoderPadding, &paddingSamples)) {
param.addInt(String8(AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES), paddingSamples);
}
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("SendMetaDataToHal: bitRate %d,"
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("SendMetaDataToHal: bitRate %d,"
" sampleRate %d, chanMask %d, delaySample %d, paddingSample %d", bitRate,
sampleRate, channelMask, delaySamples, paddingSamples));
aSink->SetParameters(param.toString());
return;
}
void AudioOffloadPlayer::SetVolume(double aVolume)
@@ -722,31 +722,31 @@ void AudioOffloadPlayer::SetVolume(doubl
MOZ_ASSERT(NS_IsMainThread());
CHECK(mAudioSink.get());
mAudioSink->SetVolume((float) aVolume);
}
void AudioOffloadPlayer::WakeLockCreate()
{
MOZ_ASSERT(NS_IsMainThread());
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __FUNCTION__));
if (!mWakeLock) {
nsRefPtr<dom::power::PowerManagerService> pmService =
dom::power::PowerManagerService::GetInstance();
NS_ENSURE_TRUE_VOID(pmService);
ErrorResult rv;
mWakeLock = pmService->NewWakeLock(NS_LITERAL_STRING("cpu"), nullptr, rv);
}
}
void AudioOffloadPlayer::WakeLockRelease()
{
MOZ_ASSERT(NS_IsMainThread());
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __FUNCTION__));
if (mWakeLock) {
ErrorResult rv;
mWakeLock->Unlock(rv);
NS_WARN_IF_FALSE(!rv.Failed(), "Failed to unlock the wakelock.");
mWakeLock = nullptr;
}
}
--- a/dom/media/omx/AudioOutput.cpp
+++ b/dom/media/omx/AudioOutput.cpp
@@ -91,23 +91,23 @@ status_t AudioOutput::Open(uint32_t aSam
mCallback = aCb;
mCallbackCookie = aCookie;
if (((aFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) || !aCb ||
!aOffloadInfo) {
return BAD_VALUE;
}
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("open(%u, %d, 0x%x, 0x%x, %d 0x%x)",
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("open(%u, %d, 0x%x, 0x%x, %d 0x%x)",
aSampleRate, aChannelCount, aChannelMask, aFormat, mSessionId, aFlags));
if (aChannelMask == CHANNEL_MASK_USE_CHANNEL_ORDER) {
aChannelMask = audio_channel_out_mask_from_count(aChannelCount);
if (0 == aChannelMask) {
- AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("open() error, can\'t derive mask for"
+ AUDIO_OFFLOAD_LOG(LogLevel::Error, ("open() error, can\'t derive mask for"
" %d audio channels", aChannelCount));
return NO_INIT;
}
}
sp<AudioTrack> t;
CallbackData* newcbd = new CallbackData(this);
@@ -122,41 +122,41 @@ status_t AudioOutput::Open(uint32_t aSam
newcbd,
0, // notification frames
mSessionId,
AudioTrack::TRANSFER_CALLBACK,
aOffloadInfo,
mUid);
if ((!t.get()) || (t->initCheck() != NO_ERROR)) {
- AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Unable to create audio track"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Unable to create audio track"));
delete newcbd;
return NO_INIT;
}
mCallbackData = newcbd;
t->setVolume(1.0);
mTrack = t;
return NO_ERROR;
}
status_t AudioOutput::Start()
{
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
if (!mTrack.get()) {
return NO_INIT;
}
mTrack->setVolume(1.0);
return mTrack->start();
}
void AudioOutput::Stop()
{
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
if (mTrack.get()) {
mTrack->stop();
}
}
void AudioOutput::Flush()
{
if (mTrack.get()) {
@@ -168,17 +168,17 @@ void AudioOutput::Pause()
{
if (mTrack.get()) {
mTrack->pause();
}
}
void AudioOutput::Close()
{
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
mTrack.clear();
delete mCallbackData;
mCallbackData = nullptr;
}
// static
void AudioOutput::CallbackWrapper(int aEvent, void* aCookie, void* aInfo)
@@ -210,29 +210,29 @@ void AudioOutput::CallbackWrapper(int aE
memset(buffer->raw, 0, buffer->size);
actualSize = buffer->size;
}
buffer->size = actualSize;
} break;
case AudioTrack::EVENT_STREAM_END:
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Callback wrapper: EVENT_STREAM_END"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Callback wrapper: EVENT_STREAM_END"));
(*me->mCallback)(me, nullptr /* buffer */, 0 /* size */,
me->mCallbackCookie, CB_EVENT_STREAM_END);
break;
case AudioTrack::EVENT_NEW_IAUDIOTRACK :
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Callback wrapper: EVENT_TEAR_DOWN"));
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Callback wrapper: EVENT_TEAR_DOWN"));
(*me->mCallback)(me, nullptr /* buffer */, 0 /* size */,
me->mCallbackCookie, CB_EVENT_TEAR_DOWN);
break;
default:
- AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("received unknown event type: %d in"
+ AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("received unknown event type: %d in"
" Callback wrapper!", aEvent));
break;
}
data->Unlock();
}
} // namespace mozilla
--- a/dom/media/omx/I420ColorConverterHelper.cpp
+++ b/dom/media/omx/I420ColorConverterHelper.cpp
@@ -6,17 +6,17 @@
#include "I420ColorConverterHelper.h"
#include <dlfcn.h>
#include "mozilla/Logging.h"
PRLogModuleInfo *gI420ColorConverterHelperLog;
-#define LOG(msg...) MOZ_LOG(gI420ColorConverterHelperLog, PR_LOG_WARNING, (msg))
+#define LOG(msg...) MOZ_LOG(gI420ColorConverterHelperLog, mozilla::LogLevel::Warning, (msg))
namespace android {
I420ColorConverterHelper::I420ColorConverterHelper()
: mHandle(nullptr)
, mConverter({nullptr, nullptr, nullptr, nullptr, nullptr})
{
if (!gI420ColorConverterHelperLog) {
--- a/dom/media/omx/MediaOmxCommonDecoder.cpp
+++ b/dom/media/omx/MediaOmxCommonDecoder.cpp
@@ -60,34 +60,34 @@ MediaOmxCommonDecoder::FirstFrameLoaded(
if (mShuttingDown) {
return;
}
MediaDecoder::FirstFrameLoaded(aInfo, aEventVisibility);
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (!CheckDecoderCanOffloadAudio()) {
- DECODER_LOG(PR_LOG_DEBUG, ("In %s Offload Audio check failed",
+ DECODER_LOG(LogLevel::Debug, ("In %s Offload Audio check failed",
__PRETTY_FUNCTION__));
return;
}
#ifdef MOZ_AUDIO_OFFLOAD
mAudioOffloadPlayer = new AudioOffloadPlayer(this);
#endif
if (!mAudioOffloadPlayer) {
return;
}
mAudioOffloadPlayer->SetSource(mReader->GetAudioOffloadTrack());
status_t err = mAudioOffloadPlayer->Start(false);
if (err != OK) {
mAudioOffloadPlayer = nullptr;
mFallbackToStateMachine = true;
- DECODER_LOG(PR_LOG_DEBUG, ("In %s Unable to start offload audio %d."
+ DECODER_LOG(LogLevel::Debug, ("In %s Unable to start offload audio %d."
"Switching to normal mode", __PRETTY_FUNCTION__, err));
return;
}
PauseStateMachine();
if (mLogicallySeeking) {
SeekTarget target = SeekTarget(mLogicalPosition,
SeekTarget::Accurate,
MediaDecoderEventVisibility::Observable);
@@ -100,17 +100,17 @@ MediaOmxCommonDecoder::FirstFrameLoaded(
ChangeState(mPlayState);
}
void
MediaOmxCommonDecoder::PauseStateMachine()
{
MOZ_ASSERT(NS_IsMainThread());
GetReentrantMonitor().AssertCurrentThreadIn();
- DECODER_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));
+ DECODER_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
if (mShuttingDown) {
return;
}
if (!GetStateMachine()) {
return;
}
@@ -123,17 +123,17 @@ MediaOmxCommonDecoder::PauseStateMachine
GetStateMachine()->TaskQueue()->Dispatch(event.forget());
}
void
MediaOmxCommonDecoder::ResumeStateMachine()
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
- DECODER_LOG(PR_LOG_DEBUG, ("%s current time %f", __PRETTY_FUNCTION__, mLogicalPosition));
+ DECODER_LOG(LogLevel::Debug, ("%s current time %f", __PRETTY_FUNCTION__, mLogicalPosition));
if (mShuttingDown) {
return;
}
if (!GetStateMachine()) {
return;
}
@@ -162,17 +162,17 @@ MediaOmxCommonDecoder::ResumeStateMachin
GetStateMachine()->TaskQueue()->Dispatch(event.forget());
UpdateLogicalPosition();
}
void
MediaOmxCommonDecoder::AudioOffloadTearDown()
{
MOZ_ASSERT(NS_IsMainThread());
- DECODER_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));
+ DECODER_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
// mAudioOffloadPlayer can be null here if ResumeStateMachine was called
// just before because of some other error.
if (mAudioOffloadPlayer) {
ResumeStateMachine();
}
}
--- a/dom/media/omx/MediaOmxCommonReader.cpp
+++ b/dom/media/omx/MediaOmxCommonReader.cpp
@@ -55,21 +55,21 @@ void MediaOmxCommonReader::CheckAudioOff
bool hasNoVideo = !HasVideo();
bool isNotStreaming
= mDecoder->GetResource()->IsDataCachedToEndOfResource(0);
// Not much benefit in trying to offload other channel types. Most of them
// aren't supported and also duration would be less than a minute
bool isTypeMusic = mAudioChannel == dom::AudioChannel::Content;
- DECODER_LOG(PR_LOG_DEBUG, ("%s meta %p, no video %d, no streaming %d,"
+ DECODER_LOG(LogLevel::Debug, ("%s meta %p, no video %d, no streaming %d,"
" channel type %d", __FUNCTION__, meta.get(), hasNoVideo,
isNotStreaming, mAudioChannel));
if ((meta.get()) && hasNoVideo && isNotStreaming && isTypeMusic &&
canOffloadStream(meta, false, false, AUDIO_STREAM_MUSIC)) {
- DECODER_LOG(PR_LOG_DEBUG, ("Can offload this audio stream"));
+ DECODER_LOG(LogLevel::Debug, ("Can offload this audio stream"));
mDecoder->SetPlatformCanOffloadAudio(true);
}
}
#endif
} // namespace mozilla
--- a/dom/media/omx/OmxDecoder.cpp
+++ b/dom/media/omx/OmxDecoder.cpp
@@ -435,31 +435,31 @@ bool OmxDecoder::SetVideoFormat() {
mVideoHeight = crop_bottom - crop_top + 1;
}
if (!mVideoSource->getFormat()->findInt32(kKeyRotation, &mVideoRotation)) {
mVideoRotation = 0;
NS_WARNING("rotation not available, assuming 0");
}
- LOG(PR_LOG_DEBUG, "display width: %d display height %d width: %d height: %d component: %s format: %d stride: %d sliceHeight: %d rotation: %d",
+ LOG(LogLevel::Debug, "display width: %d display height %d width: %d height: %d component: %s format: %d stride: %d sliceHeight: %d rotation: %d",
mDisplayWidth, mDisplayHeight, mVideoWidth, mVideoHeight, componentName,
mVideoColorFormat, mVideoStride, mVideoSliceHeight, mVideoRotation);
return true;
}
bool OmxDecoder::SetAudioFormat() {
// If the format changed, update our cached info.
if (!mAudioSource->getFormat()->findInt32(kKeyChannelCount, &mAudioChannels) ||
!mAudioSource->getFormat()->findInt32(kKeySampleRate, &mAudioSampleRate)) {
return false;
}
- LOG(PR_LOG_DEBUG, "channelCount: %d sampleRate: %d",
+ LOG(LogLevel::Debug, "channelCount: %d sampleRate: %d",
mAudioChannels, mAudioSampleRate);
return true;
}
void OmxDecoder::ReleaseDecoder()
{
mDecoder = nullptr;
@@ -530,17 +530,17 @@ bool OmxDecoder::ToVideoFrame(VideoFrame
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
SemiPlanarYUV420Frame(aFrame, aTimeUs, aData, aSize, aKeyFrame);
break;
case OMX_QCOM_COLOR_FormatYVU420SemiPlanar:
SemiPlanarYVU420Frame(aFrame, aTimeUs, aData, aSize, aKeyFrame);
break;
default:
- LOG(PR_LOG_DEBUG, "Unknown video color format %08x", mVideoColorFormat);
+ LOG(LogLevel::Debug, "Unknown video color format %08x", mVideoColorFormat);
return false;
}
return true;
}
bool OmxDecoder::ToAudioFrame(AudioFrame *aFrame, int64_t aTimeUs, void *aData, size_t aDataOffset, size_t aSize, int32_t aAudioChannels, int32_t aAudioSampleRate)
{
aFrame->Set(aTimeUs, static_cast<char *>(aData) + aDataOffset, aSize, aAudioChannels, aAudioSampleRate);
@@ -663,17 +663,17 @@ bool OmxDecoder::ReadVideo(VideoFrame *a
aFrame->Y.mHeight = mVideoHeight;
// Release to hold video buffer in OmxDecoder more.
// MediaBuffer's ref count is changed from 2 to 1.
ReleaseVideoBuffer();
} else if (length > 0) {
char *data = static_cast<char *>(mVideoBuffer->data()) + mVideoBuffer->range_offset();
if (unreadable) {
- LOG(PR_LOG_DEBUG, "video frame is unreadable");
+ LOG(LogLevel::Debug, "video frame is unreadable");
}
if (!ToVideoFrame(aFrame, timeUs, data, length, keyFrame)) {
return false;
}
}
// Check if this frame is valid or not. If not, skip it.
if ((aKeyframeSkip && timeUs < aTimeUs) || length == 0) {
@@ -687,23 +687,23 @@ bool OmxDecoder::ReadVideo(VideoFrame *a
} else {
return ReadVideo(aFrame, aTimeUs, aKeyframeSkip, aDoSeek);
}
}
else if (err == ERROR_END_OF_STREAM) {
return false;
}
else if (err == -ETIMEDOUT) {
- LOG(PR_LOG_DEBUG, "OmxDecoder::ReadVideo timed out, will retry");
+ LOG(LogLevel::Debug, "OmxDecoder::ReadVideo timed out, will retry");
return true;
}
else {
// UNKNOWN_ERROR is sometimes is used to mean "out of memory", but
// regardless, don't keep trying to decode if the decoder doesn't want to.
- LOG(PR_LOG_DEBUG, "OmxDecoder::ReadVideo failed, err=%d", err);
+ LOG(LogLevel::Debug, "OmxDecoder::ReadVideo failed, err=%d", err);
return false;
}
return true;
}
bool OmxDecoder::ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs)
{
@@ -748,21 +748,21 @@ bool OmxDecoder::ReadAudio(AudioFrame *a
}
}
else if (err == ERROR_END_OF_STREAM) {
if (aFrame->mSize == 0) {
return false;
}
}
else if (err == -ETIMEDOUT) {
- LOG(PR_LOG_DEBUG, "OmxDecoder::ReadAudio timed out, will retry");
+ LOG(LogLevel::Debug, "OmxDecoder::ReadAudio timed out, will retry");
return true;
}
else if (err != OK) {
- LOG(PR_LOG_DEBUG, "OmxDecoder::ReadAudio failed, err=%d", err);
+ LOG(LogLevel::Debug, "OmxDecoder::ReadAudio failed, err=%d", err);
return false;
}
return true;
}
nsresult OmxDecoder::Play()
{
--- a/dom/media/platforms/apple/AppleATDecoder.cpp
+++ b/dom/media/platforms/apple/AppleATDecoder.cpp
@@ -8,17 +8,17 @@
#include "MP4Reader.h"
#include "MP4Decoder.h"
#include "mp4_demuxer/Adts.h"
#include "MediaInfo.h"
#include "AppleATDecoder.h"
#include "mozilla/Logging.h"
PRLogModuleInfo* GetAppleMediaLog();
-#define LOG(...) MOZ_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#define FourCC2Str(n) ((char[5]){(char)(n >> 24), (char)(n >> 16), (char)(n >> 8), (char)(n), 0})
namespace mozilla {
AppleATDecoder::AppleATDecoder(const AudioInfo& aConfig,
FlushableMediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback)
: mConfig(aConfig)
--- a/dom/media/platforms/apple/AppleCMLinker.cpp
+++ b/dom/media/platforms/apple/AppleCMLinker.cpp
@@ -8,17 +8,17 @@
#include "AppleCMLinker.h"
#include "MainThreadUtils.h"
#include "mozilla/ArrayUtils.h"
#include "nsCocoaFeatures.h"
#include "nsDebug.h"
PRLogModuleInfo* GetAppleMediaLog();
-#define LOG(...) MOZ_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
namespace mozilla {
AppleCMLinker::LinkStatus
AppleCMLinker::sLinkStatus = LinkStatus_INIT;
void* AppleCMLinker::sLink = nullptr;
nsrefcnt AppleCMLinker::sRefCount = 0;
--- a/dom/media/platforms/apple/AppleVDADecoder.cpp
+++ b/dom/media/platforms/apple/AppleVDADecoder.cpp
@@ -19,17 +19,17 @@
#include "nsCocoaFeatures.h"
#include "nsThreadUtils.h"
#include "mozilla/Logging.h"
#include "VideoUtils.h"
#include <algorithm>
#include "gfxPlatform.h"
PRLogModuleInfo* GetAppleMediaLog();
-#define LOG(...) MOZ_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
//#define LOG_MEDIA_SHA1
namespace mozilla {
AppleVDADecoder::AppleVDADecoder(const VideoInfo& aConfig,
FlushableMediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback,
layers::ImageContainer* aImageContainer)
--- a/dom/media/platforms/apple/AppleVDALinker.cpp
+++ b/dom/media/platforms/apple/AppleVDALinker.cpp
@@ -6,17 +6,17 @@
#include <dlfcn.h>
#include "AppleVDALinker.h"
#include "MainThreadUtils.h"
#include "nsDebug.h"
PRLogModuleInfo* GetAppleMediaLog();
-#define LOG(...) MOZ_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
namespace mozilla {
AppleVDALinker::LinkStatus
AppleVDALinker::sLinkStatus = LinkStatus_INIT;
void* AppleVDALinker::sLink = nullptr;
nsrefcnt AppleVDALinker::sRefCount = 0;
--- a/dom/media/platforms/apple/AppleVTDecoder.cpp
+++ b/dom/media/platforms/apple/AppleVTDecoder.cpp
@@ -16,17 +16,17 @@
#include "mozilla/ArrayUtils.h"
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "mozilla/Logging.h"
#include "VideoUtils.h"
#include "gfxPlatform.h"
PRLogModuleInfo* GetAppleMediaLog();
-#define LOG(...) MOZ_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
//#define LOG_MEDIA_SHA1
#ifdef LOG_MEDIA_SHA1
#include "mozilla/SHA1.h"
#endif
namespace mozilla {
--- a/dom/media/platforms/apple/AppleVTLinker.cpp
+++ b/dom/media/platforms/apple/AppleVTLinker.cpp
@@ -7,17 +7,17 @@
#include <dlfcn.h>
#include "AppleVTLinker.h"
#include "MainThreadUtils.h"
#include "mozilla/ArrayUtils.h"
#include "nsDebug.h"
PRLogModuleInfo* GetAppleMediaLog();
-#define LOG(...) MOZ_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
namespace mozilla {
AppleVTLinker::LinkStatus
AppleVTLinker::sLinkStatus = LinkStatus_INIT;
void* AppleVTLinker::sLink = nullptr;
nsrefcnt AppleVTLinker::sRefCount = 0;
--- a/dom/media/platforms/ffmpeg/FFmpegLog.h
+++ b/dom/media/platforms/ffmpeg/FFmpegLog.h
@@ -3,11 +3,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __FFmpegLog_h__
#define __FFmpegLog_h__
extern PRLogModuleInfo* GetFFmpegDecoderLog();
-#define FFMPEG_LOG(...) MOZ_LOG(GetFFmpegDecoderLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define FFMPEG_LOG(...) MOZ_LOG(GetFFmpegDecoderLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#endif // __FFmpegLog_h__
--- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp
+++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp
@@ -21,17 +21,17 @@
#include "media/openmax/OMX_Audio.h"
#include "MediaData.h"
#include "MediaInfo.h"
#include <android/log.h>
#define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__)
PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#define READ_OUTPUT_BUFFER_TIMEOUT_US 3000
using namespace android;
typedef android::MediaCodecProxy MediaCodecProxy;
namespace mozilla {
GonkAudioDecoderManager::GonkAudioDecoderManager(const AudioInfo& aConfig)
--- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp
+++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp
@@ -9,17 +9,17 @@
#include "MediaCodecProxy.h"
#include "MediaData.h"
#include "mozilla/Logging.h"
#include <android/log.h>
#define GMDD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkMediaDataDecoder", __VA_ARGS__)
PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
using namespace android;
namespace mozilla {
GonkMediaDataDecoder::GonkMediaDataDecoder(GonkDecoderManager* aManager,
FlushableMediaTaskQueue* aTaskQueue,
MediaDataDecoderCallback* aCallback)
--- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp
+++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp
@@ -27,17 +27,17 @@
#include "mozilla/layers/TextureClient.h"
#define READ_OUTPUT_BUFFER_TIMEOUT_US 3000
#include <android/log.h>
#define GVDM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkVideoDecoderManager", __VA_ARGS__)
PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
using namespace mozilla::layers;
using namespace android;
typedef android::MediaCodecProxy MediaCodecProxy;
namespace mozilla {
GonkVideoDecoderManager::GonkVideoDecoderManager(
mozilla::layers::ImageContainer* aImageContainer,
--- a/dom/media/platforms/wmf/MFTDecoder.cpp
+++ b/dom/media/platforms/wmf/MFTDecoder.cpp
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MFTDecoder.h"
#include "nsThreadUtils.h"
#include "WMFUtils.h"
#include "mozilla/Logging.h"
PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
namespace mozilla {
MFTDecoder::MFTDecoder()
: mMFTProvidesOutputSamples(false)
, mDiscontinuity(true)
{
memset(&mInputStreamInfo, 0, sizeof(MFT_INPUT_STREAM_INFO));
--- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp
@@ -8,17 +8,17 @@
#include "MediaInfo.h"
#include "VideoUtils.h"
#include "WMFUtils.h"
#include "nsTArray.h"
#include "mozilla/Logging.h"
PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
namespace mozilla {
static void
AACAudioSpecificConfigToUserData(uint8_t aAACProfileLevelIndication,
const uint8_t* aAudioSpecConfig,
uint32_t aConfigLength,
nsTArray<BYTE>& aOutUserData)
--- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp
+++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp
@@ -8,17 +8,17 @@
#include "VideoUtils.h"
#include "WMFUtils.h"
#include "nsTArray.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Logging.h"
PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
namespace mozilla {
WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
FlushableMediaTaskQueue* aTaskQueue,