Bug 1810498 - Enable webrtc logging from CamerasParent (parent process). r=ng

Differential Revision: https://phabricator.services.mozilla.com/D196806
This commit is contained in:
Andreas Pehrson 2023-12-19 12:37:13 +00:00
parent 5a544bfeed
commit 3022f19dd2
2 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include "PerformanceRecorder.h"
#include "VideoFrameUtils.h"
#include "common/browser_logging/WebRtcLog.h"
#include "mozilla/AppShutdown.h"
#include "mozilla/Assertions.h"
#include "mozilla/BasePrincipal.h"
@ -1288,6 +1289,12 @@ ipc::IPCResult CamerasParent::RecvPCamerasConstructor() {
return Send__delete__(this) ? IPC_OK() : IPC_FAIL(this, "Failed to send");
}
NS_DispatchToMainThread(
NS_NewRunnableFunction(__func__, [this, self = RefPtr(this)] {
mLogHandle = new nsMainThreadPtrHolder<WebrtcLogSinkHandle>(
"CamerasParent::mLogHandle", EnsureWebrtcLogging());
}));
MOZ_ASSERT(mEngines);
mShutdownBlocker->ShutdownPromise()

View File

@ -18,6 +18,7 @@
#include "modules/video_capture/video_capture_defines.h"
#include "video/render/incoming_video_stream.h"
class WebrtcLogSinkHandle;
class nsIThread;
namespace mozilla {
@ -175,6 +176,10 @@ class CamerasParent final : public PCamerasParent,
std::map<nsCString, std::map<uint32_t, webrtc::VideoCaptureCapability>>
mAllCandidateCapabilities;
// While alive, ensure webrtc logging is hooked up to MOZ_LOG. Main thread
// only.
nsMainThreadPtrHandle<WebrtcLogSinkHandle> mLogHandle;
};
} // namespace mozilla::camera