The created Context object will be recycled by the GC if we don't hold a reference, which will lead the rs::context and its related rs::device are going to be de-constructed. So, here we'd better extend the life cycle of rs::context to the whole process by using a static global variable.
The created Context object will be recycled by the GC if we don't hold a reference, which will lead the rs::context and its related rs::device are going to be de-constructed. So, here we'd better extend the life cycle of rs::context to the whole process by using a static global variable.