Skip to content

Commit

Permalink
fix(ffmpeg): use boost lock_guard
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 17, 2018
1 parent c339daa commit 00aba46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/ffmpeg/producer/av_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ struct AVProducer::Impl

if (buffer_eof_) {
if (loop_) {
// TODO (fix): Don't loop if too short, e.g. image.
frame = Frame{};
seek_internal(start_);
} else {
Expand Down Expand Up @@ -648,7 +649,7 @@ struct AVProducer::Impl
update_state();
};

std::lock_guard<boost::mutex> lock(mutex_);
boost::lock_guard<boost::mutex> lock(mutex_);

if (!buffer_.empty() && (frame_flush_ || !frame_)) {
auto frame = core::draw_frame(make_frame(this, *frame_factory_, buffer_[0].video, buffer_[0].audio));
Expand All @@ -667,7 +668,7 @@ struct AVProducer::Impl
update_state();
};

std::lock_guard<boost::mutex> lock(mutex_);
boost::lock_guard<boost::mutex> lock(mutex_);

if (buffer_.empty() || (frame_flush_ && buffer_.size() < 4) || (prerolling_ && buffer_.size() < buffer_capacity_ / 4)) {
if (buffer_eof_) {
Expand Down Expand Up @@ -887,7 +888,6 @@ struct AVProducer::Impl

// TODO (fix) is this always best?
frame->pts = frame->best_effort_timestamp;
// TODO (fix) is this always best?

auto duration_pts = frame->pkt_duration;
if (duration_pts <= 0) {
Expand Down

0 comments on commit 00aba46

Please sign in to comment.