diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index 5629eb0c0001..4fdb96688659 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -167,7 +167,12 @@ cubeb* GetCubebContextUnlocked() return sCubebContext; } - NS_WARN_IF_FALSE(sBrandName, "Could not get brandName?"); + if (!sBrandName && NS_IsMainThread()) { + InitBrandName(); + } else { + NS_WARN_IF_FALSE(sBrandName, + "Did not initialize sbrandName, and not on the main thread?"); + } DebugOnly rv = cubeb_init(&sCubebContext, sBrandName); NS_WARN_IF_FALSE(rv == CUBEB_OK, "Could not get a cubeb context.");