From d4fc72f00d77b1d415b0e8b43e887f8a4d9c55d4 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 3 Jun 2019 10:12:21 +0300 Subject: [PATCH] Catch stream encode exceptions --- components/rgbd-sources/src/rgbd_streamer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/rgbd-sources/src/rgbd_streamer.cpp b/components/rgbd-sources/src/rgbd_streamer.cpp index 16202686a..ad8fa3f2d 100644 --- a/components/rgbd-sources/src/rgbd_streamer.cpp +++ b/components/rgbd-sources/src/rgbd_streamer.cpp @@ -194,7 +194,8 @@ void Streamer::_schedule() { pool_.push([this,uri](int id) { StreamSource *src = sources_[uri]; - if (src->rgb.rows > 0 && src->depth.rows > 0 && src->clients[0].size() > 0) { + try { + if (src && src->rgb.rows > 0 && src->depth.rows > 0 && src->clients[0].size() > 0) { vector<unsigned char> rgb_buf; cv::imencode(".jpg", src->rgb, rgb_buf); @@ -219,6 +220,9 @@ void Streamer::_schedule() { } } } + } catch(...) { + LOG(ERROR) << "Error in transmission loop"; + } unique_lock<shared_mutex> lk(src->mutex); LOG(INFO) << "Tx Frame: " << uri; -- GitLab