Skip to content

Commit

Permalink
Fixed deadlock when disabling playback repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
aangerma committed Aug 4, 2021
1 parent 03dfe63 commit 21f84f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/media/playback/playback_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void playback_sensor::open(const stream_profiles& requests)
//Playback can only play the streams that were recorded.
//Go over the requested profiles and see if they are available
LOG_DEBUG("Open Sensor " << m_sensor_id);
std::lock_guard<std::mutex> l(m_mutex);
std::lock_guard<std::recursive_mutex> l(m_mutex);
for (auto&& r : requests)
{
if (std::find_if(std::begin(m_available_profiles),
Expand Down Expand Up @@ -105,7 +105,7 @@ void playback_sensor::open(const stream_profiles& requests)
void playback_sensor::close()
{
LOG_DEBUG("Close sensor " << m_sensor_id);
std::lock_guard<std::mutex> l(m_mutex);
std::lock_guard<std::recursive_mutex> l(m_mutex);
std::vector<device_serializer::stream_identifier> closed_streams;
for (auto&& dispatcher : m_dispatchers)
{
Expand Down Expand Up @@ -138,7 +138,7 @@ notifications_callback_ptr playback_sensor::get_notifications_callback() const
void playback_sensor::start(frame_callback_ptr callback)
{
LOG_DEBUG("Start sensor " << m_sensor_id);
std::lock_guard<std::mutex> l(m_mutex);
std::lock_guard<std::recursive_mutex> l(m_mutex);
if (m_is_started == false)
{
started(m_sensor_id, callback);
Expand All @@ -150,7 +150,7 @@ void playback_sensor::start(frame_callback_ptr callback)
void playback_sensor::stop(bool invoke_required)
{
LOG_DEBUG("Stop sensor " << m_sensor_id);
std::lock_guard<std::mutex> l(m_mutex);
std::lock_guard<std::recursive_mutex> l(m_mutex);
if (m_is_started == true)
{
m_is_started = false;
Expand Down
2 changes: 1 addition & 1 deletion src/media/playback/playback_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace librealsense
std::atomic<bool> m_is_started;
device_serializer::sensor_snapshot m_sensor_description;
uint32_t m_sensor_id;
std::mutex m_mutex;
std::recursive_mutex m_mutex;
std::map<std::pair<rs2_stream, uint32_t>, std::shared_ptr<stream_profile_interface>> m_streams;
device_interface& m_parent_device;
stream_profiles m_available_profiles;
Expand Down

0 comments on commit 21f84f3

Please sign in to comment.