static GstFlowReturn gst_rtp_session_send_rtp (RTPSession * sess,
RTPSource * src, GstBuffer * buffer, gpointer user_data);
static GstFlowReturn gst_rtp_session_send_rtcp (RTPSession * sess,
- RTPSource * src, GstBuffer * buffer, gpointer user_data);
+ RTPSource * src, GstBuffer * buffer, gboolean eos, gpointer user_data);
static GstFlowReturn gst_rtp_session_sync_rtcp (RTPSession * sess,
RTPSource * src, GstBuffer * buffer, gpointer user_data);
static gint gst_rtp_session_clock_rate (RTPSession * sess, guint8 payload,
}
/* called when the session manager has an RTCP packet ready for further
- * sending */
+ * sending. The eos flag is set when an EOS event should be sent downstream as
+ * well. */
static GstFlowReturn
gst_rtp_session_send_rtcp (RTPSession * sess, RTPSource * src,
- GstBuffer * buffer, gpointer user_data)
+ GstBuffer * buffer, gboolean eos, gpointer user_data)
{
GstFlowReturn result;
GstRtpSession *rtpsession;
gst_buffer_set_caps (buffer, caps);
GST_LOG_OBJECT (rtpsession, "sending RTCP");
result = gst_pad_push (rtpsession->send_rtcp_src, buffer);
+
+ /* we have to send EOS after this packet */
+ if (eos) {
+ GST_LOG_OBJECT (rtpsession, "sending EOS");
+ gst_pad_push_event (rtpsession->send_rtcp_src, gst_event_new_eos ());
+ }
} else {
GST_DEBUG_OBJECT (rtpsession, "not sending RTCP, no output pad");
gst_buffer_unref (buffer);
case GST_EVENT_EOS:{
GstClockTime current_time;
+ /* push downstream FIXME, we are not supposed to leave the session just
+ * because we stop sending. */
ret = gst_pad_push_event (rtpsession->send_rtp_src, event);
current_time = gst_clock_get_time (rtpsession->priv->sysclock);
+ GST_DEBUG_OBJECT (rtpsession, "scheduling BYE message");
rtp_session_send_bye (rtpsession->priv->session, "End of stream",
current_time);
break;
if (is_rtcp_time (sess, current_time, &data)) {
if (sess->source->received_bye) {
/* generate BYE instead */
+ GST_DEBUG ("generating BYE message");
session_bye (sess, &data);
sess->sent_bye = TRUE;
} else {
/* close the RTCP packet */
gst_rtcp_buffer_end (data.rtcp);
+ GST_DEBUG ("sending packet");
if (sess->callbacks.send_rtcp)
result = sess->callbacks.send_rtcp (sess, sess->source, data.rtcp,
- sess->send_rtcp_user_data);
- else
+ sess->sent_bye, sess->send_rtcp_user_data);
+ else {
+ GST_DEBUG ("freeing packet");
gst_buffer_unref (data.rtcp);
+ }
}
return result;
* @sess: an #RTPSession
* @src: the #RTPSource
* @buffer: the RTCP buffer ready for sending
+ * @eos: if an EOS event should be pushed
* @user_data: user data specified when registering
*
* This callback will be called when @sess has @buffer ready for sending to
*
* Returns: a #GstFlowReturn.
*/
-typedef GstFlowReturn (*RTPSessionSendRTCP) (RTPSession *sess, RTPSource *src, GstBuffer *buffer, gpointer user_data);
+typedef GstFlowReturn (*RTPSessionSendRTCP) (RTPSession *sess, RTPSource *src, GstBuffer *buffer,
+ gboolean eos, gpointer user_data);
/**
* RTPSessionSyncRTCP: