Reset class members to NULL after gst_*_unref()
This commit is contained in:
parent
f8442da945
commit
facb2f9a81
@ -185,31 +185,41 @@ void CvCapture_GStreamer::close()
|
|||||||
if(pipeline) {
|
if(pipeline) {
|
||||||
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
|
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
|
||||||
gst_object_unref(GST_OBJECT(pipeline));
|
gst_object_unref(GST_OBJECT(pipeline));
|
||||||
|
pipeline = NULL;
|
||||||
}
|
}
|
||||||
if(uridecodebin){
|
if(uridecodebin){
|
||||||
gst_object_unref(GST_OBJECT(uridecodebin));
|
gst_object_unref(GST_OBJECT(uridecodebin));
|
||||||
|
uridecodebin = NULL;
|
||||||
}
|
}
|
||||||
if(color){
|
if(color){
|
||||||
gst_object_unref(GST_OBJECT(color));
|
gst_object_unref(GST_OBJECT(color));
|
||||||
|
color = NULL;
|
||||||
}
|
}
|
||||||
if(sink){
|
if(sink){
|
||||||
gst_object_unref(GST_OBJECT(sink));
|
gst_object_unref(GST_OBJECT(sink));
|
||||||
|
sink = NULL;
|
||||||
}
|
}
|
||||||
if(buffer)
|
if(buffer) {
|
||||||
gst_buffer_unref(buffer);
|
gst_buffer_unref(buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
}
|
||||||
if(frame) {
|
if(frame) {
|
||||||
frame->imageData = 0;
|
frame->imageData = 0;
|
||||||
cvReleaseImage(&frame);
|
cvReleaseImage(&frame);
|
||||||
|
frame = NULL;
|
||||||
}
|
}
|
||||||
if(caps){
|
if(caps){
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref(caps);
|
||||||
|
caps = NULL;
|
||||||
}
|
}
|
||||||
if(buffer_caps){
|
if(buffer_caps){
|
||||||
gst_caps_unref(buffer_caps);
|
gst_caps_unref(buffer_caps);
|
||||||
|
buffer_caps = NULL;
|
||||||
}
|
}
|
||||||
#if GST_VERSION_MAJOR > 0
|
#if GST_VERSION_MAJOR > 0
|
||||||
if(sample){
|
if(sample){
|
||||||
gst_sample_unref(sample);
|
gst_sample_unref(sample);
|
||||||
|
sample = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user