static __inline__ void rtp_session_finalize(RTP_session *rtp_s) { rtp_transport_close(&rtp_s->transport); if (rtp_s->fill_pool) rtp_fill_pool_free(rtp_s); if (rtp_s->consumer) bq_consumer_free(rtp_s->consumer); rtsp_session_unref(rtp_s->rtsp); if (rtp_s->audio_rtp) rtp_session_unref(rtp_s->audio_rtp); g_free(rtp_s->uri); g_free(rtp_s); }
/** * Deallocates an RTP session, closing its tracks and transports * * @param session_gen The RTP session to free * * @see rtp_session_new * * @internal This function should only be called from g_slist_foreach. */ static void rtp_session_free(gpointer session_gen, ATTR_UNUSED gpointer unused) { RTP_session *session = (RTP_session*)session_gen; /* Call this first, so that all the reading thread will stop * before continuing to free resources; another way should be to * ensure that we're paused before doing this but doesn't matter * now. */ rtp_transport_close(session); if (session->fill_pool) rtp_fill_pool_free(session); /* Remove the consumer */ bq_consumer_free(session->consumer); /* Deallocate memory */ g_free(session->uri); g_slice_free(RTP_session, session); }