diff --git a/components/rgbd-sources/src/net.cpp b/components/rgbd-sources/src/net.cpp
index b709c92f39a841ee13c7c199167ccf2ee721d46d..4c606aa36c802db14c5a0a0291775002d5a45e87 100644
--- a/components/rgbd-sources/src/net.cpp
+++ b/components/rgbd-sources/src/net.cpp
@@ -72,13 +72,12 @@ void NetSource::_recv(const vector<unsigned char> &jpg, const vector<unsigned ch
 	unique_lock<shared_mutex> lk(host_->mutex());
 	rgb_ = tmp_rgb;
 	tmp_depth.convertTo(depth_, CV_32FC1, 1.0f/(16.0f*100.0f));
+	N_--;
 	lk.unlock();
 
 	std::chrono::duration<double> elapsed =
 		std::chrono::high_resolution_clock::now() - start;
 	LOG(INFO) << "ELAPSED DECODE: " << elapsed.count();
-
-	N_--;
 }
 
 void NetSource::setPose(const Eigen::Matrix4f &pose) {