Closed Bug 1659521 Opened 5 months ago Closed 5 months ago

Add a header that exports the CDM header and undefines problematic macros from X11

Categories

(Core :: Audio/Video: GMP, task, P3)

task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: bryce, Assigned: bryce)

References

Details

Attachments

(1 file)

X11 defines various macros that end up clashing with common names like 'None' and 'Status'. There's existing are to work around this[0], and we've got some code in Media that sidesteps the problem via undefs[1].

I would like to use some of the CDM enums in ipdl (see bug 1654383). However that currently fails due to the ipc codegen bringing in the X11 headers which define a Status macro which then tramples the Status in the CDM headers. Because I can't #undef in ipdl I think having a header that wraps the CDM headers and does the undeffing is the next best thing. If we put this new header in the gmp-api dir it also shows that we use the CDM symbols as part of the GMP-API (though the whole documenting of the GMP-API has grown a little wonky over time).

The other way we could deal with this is to prevent X11 headers being dragged into the IPC codegen, but that's a bigger and non-media specific task. We already have a bandaid in place for this[1] which I'm okay with expanding a bit.

[0] https://searchfox.org/mozilla-central/source/gfx/src/X11UndefineNone.h
[1] https://searchfox.org/mozilla-central/rev/fa7f47027917a186fb2052dee104cd06c21dd76f/dom/media/gmp/GMPMessageUtils.h#12-14

When using the CDM headers in ipc codegen we run into issues where X11 defines
a Status macro that tramples the CDM headers. Since we can't undef Status in
ipdl we can instead add a header that ipdl can include which does the undef.

Pushed by bvandyk@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8fa30fb9c4b0
Add file that exposes CDM symbols and undefs clashing X11 macros. r=alwu
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.