rtph264pay: fix potential crash when shutting down

A race condition in the state change function may cause buffers
to be unreffed while they are still used by the streaming thread
in gst_rtp_h264_pay_send_sps_pps() resulting in a crash. Chain
up to the parent class first in the state change function to
make sure streaming has stopped and only then free those buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=741381
This commit is contained in:
Patrick Radizi 2014-12-11 10:16:06 +01:00 committed by Tim-Philipp Müller
parent de8d00348e
commit 0a359cdbdc

View file

@ -1336,6 +1336,13 @@ gst_rtp_h264_pay_change_state (GstElement * element, GstStateChange transition)
rtph264pay->send_spspps = FALSE;
gst_adapter_clear (rtph264pay->adapter);
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
rtph264pay->last_spspps = -1;
gst_rtp_h264_pay_clear_sps_pps (rtph264pay);
@ -1344,8 +1351,6 @@ gst_rtp_h264_pay_change_state (GstElement * element, GstStateChange transition)
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return ret;
}