`dom/media/webrtc`: use fmt format_as/operator<< instead of explicit log conversions
Categories
(Core :: WebRTC, task)
Tracking
()
People
(Reporter: alwu, Assigned: calvincramer)
References
Details
(Keywords: good-first-bug)
Attachments
(5 external files)
Follow-up to Bug 2044124, which migrated dom/media logging to MOZ_LOG_FMT.
During review of D304270 (Part 19), reviewers (bwc, pehrsons) noted several remaining dom/media/webrtc log call sites that still perform explicit string conversions that {fmt} could handle automatically via format_as free functions or operator<< overloads. Converting these sites removes per-call-site boilerplate and may also provide a small binary-size benefit.
Concrete examples identified during review:
-
dom/media/webrtc/MediaEngineRemoteVideoSource.cppLOG("ChooseCapability({})...", ToString(distanceMode))- Add a
format_asimplementation for the distance-mode type so it can be logged directly as:
LOG("ChooseCapability({})...", distanceMode). ErrorNames.h'sformat_as(nsresult)provides a useful reference pattern.
-
dom/media/webrtc/MediaEngineRemoteVideoSource.cppLogCapability(...)logsConvertVideoTypeToCStr(aCapability.videoType).- Add a
format_asimplementation for the video-type enum and log the enum directly.
-
dom/media/webrtc/MediaEngineWebRTC.cppEnumerateMicrophoneDeviceslogsNS_ConvertUTF16toUTF8(deviceInfo->Name()).get().- Log the
nsStringdirectly using the existing string formatter /operator<<support.
-
As noted by
bwc, there are likely "lots of similar places scattered around"dom/media.- Opportunistically convert additional cases while touching this area.
This is a behavior-preserving logging cleanup only. No new tests are required; a successful build is sufficient validation.
| Assignee | ||
Comment 1•2 months ago
|
||
I'm spending some time on this. I don't think I can assign myself, but please do if you can @alwu
| Assignee | ||
Comment 2•1 month ago
|
||
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
| Assignee | ||
Comment 4•1 month ago
|
||
| Assignee | ||
Comment 5•1 month ago
|
||
| Assignee | ||
Comment 6•1 month ago
|
||
Fix lint warnings
| Assignee | ||
Comment 7•1 month ago
|
||
Added 5 changes just to start the process. There's still lots more places to review in webrtc
Not sure if these multiple small commits with one diff each is best for review process. What's the standard here?
Description
•