static void
client_unlink_session (GstRTSPClient * client, GstRTSPSession * session)
{
- GList *medias;
-
/* unlink all media managed in this session */
- for (medias = session->medias; medias; medias = g_list_next (medias)) {
- GstRTSPSessionMedia *media = medias->data;
+ while (g_list_length (session->medias) > 0) {
+ GstRTSPSessionMedia *media = g_list_first (session->medias)->data;
gst_rtsp_session_media_set_state (media, GST_STATE_NULL);
unlink_session_streams (client, session, media);
- /* unmanage the media in the session. */
+ /* unmanage the media in the session. this will modify session->medias */
gst_rtsp_session_release_media (session, media);
}
}