Bug 1802520 - Allow disabling real-time callback tracing in configure. r=glandium,pehrsons,media-playback-reviewers,alwu

Differential Revision: https://phabricator.services.mozilla.com/D163111
This commit is contained in:
Paul Adenot 2022-11-29 15:29:08 +00:00
Родитель d2aa0af52d
Коммит 37656b1b28
11 изменённых файлов: 19 добавлений и 17 удалений

Просмотреть файл

@ -16,7 +16,7 @@ mozilla::AsyncLogger gAudioCallbackTraceLogger;
static std::atomic<int> gTracingStarted(0);
void StartAudioCallbackTracing() {
#ifdef TRACING
#ifdef MOZ_REAL_TIME_TRACING
int cnt = gTracingStarted.fetch_add(1, std::memory_order_seq_cst);
if (cnt == 0) {
// This is a noop if the logger has not been enabled.
@ -26,7 +26,7 @@ void StartAudioCallbackTracing() {
}
void StopAudioCallbackTracing() {
#ifdef TRACING
#ifdef MOZ_REAL_TIME_TRACING
int cnt = gTracingStarted.fetch_sub(1, std::memory_order_seq_cst);
if (cnt == 1) {
// This is a noop if the logger has not been enabled.
@ -37,13 +37,17 @@ void StopAudioCallbackTracing() {
void AutoTracer::PrintEvent(const char* aName, const char* aCategory,
const char* aComment, TracingPhase aPhase) {
#ifdef MOZ_REAL_TIME_TRACING
mLogger.Log(aName, aCategory, aComment, aPhase);
#endif
}
void AutoTracer::PrintBudget(const char* aName, const char* aCategory,
uint64_t aDuration, uint64_t aFrames,
uint64_t aSampleRate) {
#ifdef MOZ_REAL_TIME_TRACING
mLogger.LogDuration(aName, aCategory, aDuration, aFrames, aSampleRate);
#endif
}
AutoTracer::AutoTracer(AsyncLogger& aLogger, const char* aLocation,

Просмотреть файл

@ -30,7 +30,7 @@ extern mozilla::AsyncLogger gAudioCallbackTraceLogger;
void StartAudioCallbackTracing();
void StopAudioCallbackTracing();
#ifdef TRACING
#ifdef MOZ_REAL_TIME_TRACING
# define TRACE(aName) AutoTracer trace(gAudioCallbackTraceLogger, aName);
# define TRACE_COMMENT(aName, aFmt, ...) \
AutoTracer trace(gAudioCallbackTraceLogger, aName, \

Просмотреть файл

@ -25,8 +25,6 @@ UNIFIED_SOURCES += [
"VP8TrackEncoder.cpp",
]
DEFINES["TRACING"] = True
FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [

Просмотреть файл

@ -20,8 +20,6 @@ LOCAL_INCLUDES += [
"/dom/media",
]
DEFINES["TRACING"] = True
include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul"

Просмотреть файл

@ -374,7 +374,6 @@ if CONFIG["MOZ_WEBRTC"]:
]
DEFINES["MOZILLA_INTERNAL_API"] = True
DEFINES["TRACING"] = True
if CONFIG["MOZ_ANDROID_HLS_SUPPORT"]:
DEFINES["MOZ_ANDROID_HLS_SUPPORT"] = True

Просмотреть файл

@ -138,9 +138,6 @@ if CONFIG["INTEL_ARCHITECTURE"]:
DEFINES["USE_SSE2"] = True
SOURCES["AudioNodeEngineSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
# Allow outputing trace points from Web Audio API code
DEFINES["TRACING"] = True
include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul"

Просмотреть файл

@ -1324,6 +1324,7 @@ MediaConduitErrorCode WebrtcVideoConduit::SendVideoFrame(
MOZ_ASSERT(!aFrame.color_space(), "Unexpected use of color space");
MOZ_ASSERT(!aFrame.has_update_rect(), "Unexpected use of update rect");
#ifdef MOZ_REAL_TIME_TRACING
if (profiler_is_active()) {
MutexAutoLock lock(mMutex);
nsAutoCStringN<256> ssrcsCommaSeparated;
@ -1345,6 +1346,7 @@ MediaConduitErrorCode WebrtcVideoConduit::SendVideoFrame(
TRACE_COMMENT("VideoConduit::SendVideoFrame", "t-delta=%.1fms, ssrcs=%s",
timestampDelta / 1000.f, ssrcsCommaSeparated.get());
}
#endif
mVideoBroadcaster.OnFrame(aFrame);
@ -1661,6 +1663,7 @@ void WebrtcVideoConduit::OnFrame(const webrtc::VideoFrame& video_frame) {
VideoLatencyUpdate(now - timestamp);
}
}
#ifdef MOZ_REAL_TIME_TRACING
if (profiler_is_active()) {
MutexAutoLock lock(mMutex);
// The first frame has a delta of zero.
@ -1674,6 +1677,7 @@ void WebrtcVideoConduit::OnFrame(const webrtc::VideoFrame& video_frame) {
timestampDelta * 1000.f / webrtc::kVideoPayloadTypeFrequency,
localRecvSsrc);
}
#endif
mRenderer->RenderVideoFrame(*video_frame.video_frame_buffer(),
video_frame.timestamp(),

Просмотреть файл

@ -5,9 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include("/dom/media/webrtc/third_party_build/webrtc.mozbuild")
# Allow outputing trace points from the libwebrtc glue code
DEFINES["TRACING"] = True
LOCAL_INCLUDES += [
"!/ipc/ipdl/_ipdlheaders",
"/dom/media/gmp", # for GMPLog.h,

Просмотреть файл

@ -119,7 +119,6 @@ CXXFLAGS += [
"-Wno-error=attributes",
]
DEFINES["TRACING"] = True
FINAL_LIBRARY = "xul"
# Add libFuzzer configuration directives

Просмотреть файл

@ -24,6 +24,4 @@ UNIFIED_SOURCES += [
"RtpLogger.cpp",
]
DEFINES["TRACING"] = True
FINAL_LIBRARY = "xul"

Просмотреть файл

@ -761,6 +761,14 @@ set_config("MOZ_VORBIS", sample_type_is_float)
set_define("MOZ_TREMOR", sample_type_is_s16)
set_config("MOZ_TREMOR", sample_type_is_s16)
option(
"--disable-real-time-tracing",
help="Disable tracing of real-time audio callbacks",
)
set_config("MOZ_REAL_TIME_TRACING", True, when="--enable-real-time-tracing")
set_define("MOZ_REAL_TIME_TRACING", True, when="--enable-real-time-tracing")
# OpenMAX IL Decoding Support
# ==============================================================
option("--enable-openmax", help="Enable OpenMAX IL for video/audio decoding")