PlatformThread: add support for detached threads.
The change introduces support for detachable PlatformThreads, for which the Stop() call doesn't wait until the thread has finished executing. The change also introduces rtc::ThreadAttributes that carries priority and detachability thread attributes. It additionally refactors all known use to use the new semantics. Bug: b:181572711, webrtc:12659 Change-Id: Id96e87c2a0dafabc8047767d241fd5da4505d14c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214704 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33796}
This commit is contained in:
committed by
Commit Bot
parent
6ef4af9546
commit
97c4458c8f
@ -1042,7 +1042,7 @@ int32_t AudioDeviceLinuxALSA::StartRecording() {
|
||||
// RECORDING
|
||||
_ptrThreadRec.reset(new rtc::PlatformThread(
|
||||
RecThreadFunc, this, "webrtc_audio_module_capture_thread",
|
||||
rtc::kRealtimePriority));
|
||||
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)));
|
||||
|
||||
_ptrThreadRec->Start();
|
||||
|
||||
@ -1160,7 +1160,7 @@ int32_t AudioDeviceLinuxALSA::StartPlayout() {
|
||||
// PLAYOUT
|
||||
_ptrThreadPlay.reset(new rtc::PlatformThread(
|
||||
PlayThreadFunc, this, "webrtc_audio_module_play_thread",
|
||||
rtc::kRealtimePriority));
|
||||
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)));
|
||||
_ptrThreadPlay->Start();
|
||||
|
||||
int errVal = LATE(snd_pcm_prepare)(_handlePlayout);
|
||||
|
||||
@ -158,16 +158,16 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
|
||||
#endif
|
||||
|
||||
// RECORDING
|
||||
_ptrThreadRec.reset(new rtc::PlatformThread(RecThreadFunc, this,
|
||||
"webrtc_audio_module_rec_thread",
|
||||
rtc::kRealtimePriority));
|
||||
_ptrThreadRec.reset(new rtc::PlatformThread(
|
||||
RecThreadFunc, this, "webrtc_audio_module_rec_thread",
|
||||
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)));
|
||||
|
||||
_ptrThreadRec->Start();
|
||||
|
||||
// PLAYOUT
|
||||
_ptrThreadPlay.reset(new rtc::PlatformThread(
|
||||
PlayThreadFunc, this, "webrtc_audio_module_play_thread",
|
||||
rtc::kRealtimePriority));
|
||||
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)));
|
||||
_ptrThreadPlay->Start();
|
||||
|
||||
_initialized = true;
|
||||
|
||||
Reference in New Issue
Block a user