According to what mentioned by @Botje, using a std::unique_ptr to GstPad as a private member is actually wrong design here. The issue is that while the sink_pad in the callback is released at the end of the function, the parameter new_pad is not. That's indicates that not all the GstPad* own the object it points to. Thus using std::unique_ptr in this context is inappropriate.