In VideoCaptureModulePipeWire lock around started_
CaptureSettings() can read started_ on the api thread at any time. But it is written and read in pipewire callbacks, on other threads. A lock seems suitable. Bug: webrtc:15181 Change-Id: I3d26f02408a4e56921b955f059e504ffa9b8cae9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306121 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40286}
This commit is contained in:
parent
6bb12e5732
commit
bd14a73f81
@ -177,6 +177,8 @@ int32_t VideoCaptureModulePipeWire::StopCapture() {
|
||||
}
|
||||
|
||||
bool VideoCaptureModulePipeWire::CaptureStarted() {
|
||||
MutexLock lock(&api_lock_);
|
||||
|
||||
return started_;
|
||||
}
|
||||
|
||||
@ -294,6 +296,7 @@ void VideoCaptureModulePipeWire::OnStreamStateChanged(
|
||||
static_cast<VideoCaptureModulePipeWire*>(data);
|
||||
RTC_DCHECK(that);
|
||||
|
||||
MutexLock lock(&that->api_lock_);
|
||||
switch (state) {
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
that->started_ = true;
|
||||
|
||||
@ -46,7 +46,7 @@ class VideoCaptureModulePipeWire : public VideoCaptureImpl {
|
||||
rtc::scoped_refptr<PipeWireSession> session_;
|
||||
int node_id_;
|
||||
VideoCaptureCapability configured_capability_;
|
||||
bool started_;
|
||||
bool started_ RTC_GUARDED_BY(api_lock_);
|
||||
|
||||
struct pw_stream* stream_;
|
||||
struct spa_hook stream_listener_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user