Closed Bug 1560720 Opened 5 years ago Closed 5 years ago

audio_thread_priority is always built even if unused

Categories

(Core :: Audio/Video: cubeb, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: jbeich, Assigned: padenot)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Remoting is not enabled on Tier3 platforms, so building audio_thread_priority brings no benefit.

https://searchfox.org/mozilla-central/rev/543e1fbd04a8/dom/media/CubebUtils.cpp#60-63
https://searchfox.org/mozilla-central/rev/543e1fbd04a8/toolkit/library/rust/gkrust-features.mozbuild#26-29

$ c++ -v
FreeBSD clang version 8.0.1 (branches/release_80 363030) (based on LLVM 8.0.1)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

$ rustc -vV
rustc 1.37.0-nightly
binary: rustc
commit-hash: b25ee644971a
commit-date: 2019-06-17
host: x86_64-unknown-freebsd
release: 1.37.0-nightly
LLVM version: 8.0
$ ./mach bootstrap
$ ./mach build
[...]
error[E0412]: cannot find type `RtPriorityHandleInternal` in this scope
  --> third_party/rust/audio_thread_priority/src/lib.rs:52:29
   |
52 | pub type RtPriorityHandle = RtPriorityHandleInternal;
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^ help: a type alias with a similar name exists: `RtPriorityHandle`
error[E0425]: cannot find function `promote_current_thread_to_real_time_internal` in this scope
  --> third_party/rust/audio_thread_priority/src/lib.rs:73:12
   |
73 |     return promote_current_thread_to_real_time_internal(audio_buffer_frames, audio_samplerate_hz);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `promote_current_thread_to_real_time`
error[E0425]: cannot find function `demote_current_thread_from_real_time_internal` in this scope
  --> third_party/rust/audio_thread_priority/src/lib.rs:87:12
   |
87 |     return demote_current_thread_from_real_time_internal(handle);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `demote_current_thread_from_real_time`
warning: unused `#[macro_use]` import
 --> third_party/rust/audio_thread_priority/src/lib.rs:9:1
  |
9 | #[macro_use]
  | ^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
error: Could not compile `audio_thread_priority`.
[...]
toolkit/library/libxul.so
ld.lld: error: undefined symbol: atp_promote_current_thread_to_real_time
>>> referenced by Unified_cpp_dom_media4.cpp
>>>               ../../dom/media/Unified_cpp_dom_media4.o:(mozilla::GraphRunner::Run())
ld.lld: error: undefined symbol: atp_demote_current_thread_from_real_time
>>> referenced by Unified_cpp_dom_media4.cpp
>>>               ../../dom/media/Unified_cpp_dom_media4.o:(mozilla::GraphRunner::Run())
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Attached patch fix (obsolete) — Splinter Review

Can you help landing a fix? MOZ_CUBEB_REMOTING should probably be factored out into toolkit/moz.configure. However, doing so myself is kinda pointless without ability to iterate on review feedback via Phabricator.

Flags: needinfo?(padenot)

(In reply to Jan Beich from comment #0)

Remoting is not enabled on Tier3 platforms, so building audio_thread_priority brings no benefit.

It's not only useful for remoting, and quite critical for AudioWorklet, that we're rolling out soon. I don't know how to promote a thread on FreeBSD, but I can at least unbreak the build.

Flags: needinfo?(padenot)
Pushed by padenot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a914cf0cb936 Provide a blanket/noop implementation of audio_thread_priority for platform without a backend. r=kinetik

Comment on attachment 9073620 [details]
Bug 1560720 - Provide a blanket/noop implementation of audio_thread_priority for platform without a backend. r?kinetik

Built fine on FreeBSD.

Attachment #9073620 - Flags: feedback+

(In reply to Paul Adenot (:padenot) from comment #3)

I don't know how to promote a thread on FreeBSD...

What do you mean by "promote"? Give a thread a realtime priority without requiring root? rtkit hasn't been ported to non-Linux kernels. And Tier3 also includes Solaris, DragonFly, NetBSD, OpenBSD, each one implementing threading differently. Besides, sandboxing isn't implemented on Tier3 to protect from audio thread being a DoS vector.

Attachment #9073391 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Assignee: nobody → padenot

(In reply to Jan Beich from comment #7)

What do you mean by "promote"? Give a thread a realtime priority without requiring root? rtkit hasn't been ported to non-Linux kernels.

Oh, there's already a DBus daemon for giving processes realtime priority after PolKit authorization? Nice, I was thinking of writing a similar thing myself, I'll try porting this one instead! Thanks for the link!! :)

Besides, sandboxing isn't implemented on Tier3 to protect from audio thread being a DoS vector.

IIRC OpenBSD pledge support was merged? Not sure if audio process is enabled there though.

I'll probably get around to trying to add FreeBSD Capsicum sandboxing sometime soon..

(In reply to greg v [:myfreeweb] from comment #9)

IIRC OpenBSD pledge support was merged?

Not sure how much bug 1457092 really covers. For one, RDD was disabled in bug 1536126.
https://searchfox.org/mozilla-central/source/xpcom/build/GeckoProcessTypes.h
https://searchfox.org/mozilla-central/search?q=symbol:_ZN7mozilla3dom12ContentChild14SetProcessNameERK12nsTSubstringIDsE

Not sure if audio process is enabled there though.

Bug 1467982 plans to. May help wih https://marc.info/?t=155920584900002

Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: