Commit e2facfa5 authored by Guillaume Roguez's avatar Guillaume Roguez

#30433: video_mixer: use std::lock_guard than std::unique_lock

parent 8e1cae02
...@@ -69,19 +69,19 @@ VideoMixer::~VideoMixer() ...@@ -69,19 +69,19 @@ VideoMixer::~VideoMixer()
void VideoMixer::attached(Observable<VideoFrameSP>* ob) void VideoMixer::attached(Observable<VideoFrameSP>* ob)
{ {
std::unique_lock<std::mutex> lk(mutex_); std::lock_guard<std::mutex> lk(mutex_);
sources_.push_back(ob); sources_.push_back(ob);
} }
void VideoMixer::detached(Observable<VideoFrameSP>* ob) void VideoMixer::detached(Observable<VideoFrameSP>* ob)
{ {
std::unique_lock<std::mutex> lk(mutex_); std::lock_guard<std::mutex> lk(mutex_);
sources_.remove(ob); sources_.remove(ob);
} }
void VideoMixer::update(Observable<VideoFrameSP>* ob, VideoFrameSP& frame_p) void VideoMixer::update(Observable<VideoFrameSP>* ob, VideoFrameSP& frame_p)
{ {
std::unique_lock<std::mutex> lk(mutex_); std::lock_guard<std::mutex> lk(mutex_);
int i=0; int i=0;
for (auto x : sources_) { for (auto x : sources_) {
if (x == ob) break; if (x == ob) break;
...@@ -132,7 +132,7 @@ void VideoMixer::render_frame(VideoFrame& input, const int index) ...@@ -132,7 +132,7 @@ void VideoMixer::render_frame(VideoFrame& input, const int index)
void VideoMixer::setDimensions(int width, int height) void VideoMixer::setDimensions(int width, int height)
{ {
std::unique_lock<std::mutex> lk(mutex_); std::lock_guard<std::mutex> lk(mutex_);
width_ = width; width_ = width;
height_ = height; height_ = height;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment