+2008-10-07 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ Patch by: Håvard Graff <havard dot graff at tandberg dot com>
+
+ * gst/rtpmanager/gstrtpbin-marshal.list:
+ Add marshaller for new action signal.
+
+ * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_get_internal_session),
+ (gst_rtp_bin_class_init):
+ * gst/rtpmanager/gstrtpbin.h:
+ Add action signal to retrieve the internal RTPSession object.
+
+ * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_class_init),
+ (gst_rtp_session_get_property), (gst_rtp_session_release_pad):
+ Add property to access the internal RTPSession object.
+
+ * gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
+ (check_collision):
+ * gst/rtpmanager/rtpsession.h:
+ Add action signal to retrieve an RTPSource object by SSRC.
+ See #555396.
+
2008-10-07 Stefan Kost <ensonic@users.sf.net>
* gst/selector/gstoutputselector.c:
UINT:UINT
BOXED:UINT
BOXED:UINT,UINT
+OBJECT:UINT
VOID:UINT,OBJECT
VOID:UINT,UINT
VOID:OBJECT,OBJECT
#include "gstrtpbin-marshal.h"
#include "gstrtpbin.h"
+#include "rtpsession.h"
#include "gstrtpsession.h"
#include "gstrtpjitterbuffer.h"
{
SIGNAL_REQUEST_PT_MAP,
SIGNAL_CLEAR_PT_MAP,
+ SIGNAL_GET_INTERNAL_SESSION,
SIGNAL_ON_NEW_SSRC,
SIGNAL_ON_SSRC_COLLISION,
GST_RTP_BIN_UNLOCK (bin);
}
+static RTPSession *
+gst_rtp_bin_get_internal_session (GstRtpBin * bin, guint session_id)
+{
+ RTPSession *internal_session = NULL;
+ GstRtpBinSession *session;
+
+ GST_RTP_BIN_LOCK (bin);
+ GST_DEBUG_OBJECT (bin, "retrieving internal RTPSession object, index: %d",
+ session_id);
+ session = find_session_by_id (bin, (gint) session_id);
+ if (session) {
+ g_object_get (session->session, "internal-session", &internal_session,
+ NULL);
+ }
+ GST_RTP_BIN_UNLOCK (bin);
+
+ return internal_session;
+}
+
static void
gst_rtp_bin_propagate_property_to_jitterbuffer (GstRtpBin * bin,
const gchar * name, const GValue * value)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass,
clear_pt_map), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
0, G_TYPE_NONE);
+ /**
+ * GstRtpBin::get-internal-session:
+ * @rtpbin: the object which received the signal
+ * @id: the session id
+ *
+ * Request the internal RTPSession object as #GObject in session @id.
+ */
+ gst_rtp_bin_signals[SIGNAL_GET_INTERNAL_SESSION] =
+ g_signal_new ("get-internal-session", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass,
+ get_internal_session), NULL, NULL, gst_rtp_bin_marshal_OBJECT__UINT,
+ RTP_TYPE_SESSION, 1, G_TYPE_UINT);
/**
* GstRtpBin::on-new-ssrc:
gstbin_class->handle_message = GST_DEBUG_FUNCPTR (gst_rtp_bin_handle_message);
klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_pt_map);
+ klass->get_internal_session =
+ GST_DEBUG_FUNCPTR (gst_rtp_bin_get_internal_session);
GST_DEBUG_CATEGORY_INIT (gst_rtp_bin_debug, "rtpbin", 0, "RTP bin");
}
#include <gst/gst.h>
+#include "rtpsession.h"
+
#define GST_TYPE_RTP_BIN \
(gst_rtp_bin_get_type())
#define GST_RTP_BIN(obj) \
GstBinClass parent_class;
/* get the caps for pt */
- GstCaps* (*request_pt_map) (GstRtpBin *rtpbin, guint session, guint pt);
- void (*clear_pt_map) (GstRtpBin *rtpbin);
+ GstCaps* (*request_pt_map) (GstRtpBin *rtpbin, guint session, guint pt);
+
+ /* action signals */
+ void (*clear_pt_map) (GstRtpBin *rtpbin);
+ RTPSession* (*get_internal_session) (GstRtpBin *rtpbin, guint session_id);
+ /* session manager signals */
void (*on_new_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_ssrc_collision) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_ssrc_validated) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
PROP_SDES_NOTE,
PROP_NUM_SOURCES,
PROP_NUM_ACTIVE_SOURCES,
+ PROP_INTERNAL_SESSION,
PROP_LAST
};
"The number of active sources in the session", 0, G_MAXUINT,
DEFAULT_NUM_ACTIVE_SOURCES, G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class, PROP_INTERNAL_SESSION,
+ g_param_spec_object ("internal-session", "Internal Session",
+ "The internal RTPSession object", RTP_TYPE_SESSION,
+ G_PARAM_READABLE));
+
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_session_change_state);
gstelement_class->request_new_pad =
g_value_set_uint (value,
rtp_session_get_num_active_sources (priv->session));
break;
+ case PROP_INTERNAL_SESSION:
+ g_value_set_object (value, priv->session);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
return;
}
}
-
-void
-gst_rtp_session_set_ssrc (GstRtpSession * sess, guint32 ssrc)
-{
- rtp_session_set_internal_ssrc (sess->priv->session, ssrc);
-}
#include <gst/rtp/gstrtcpbuffer.h>
#include <gst/netbuffer/gstnetbuffer.h>
-
+#include "gstrtpbin-marshal.h"
#include "rtpsession.h"
GST_DEBUG_CATEGORY_STATIC (rtp_session_debug);
/* signals and args */
enum
{
+ SIGNAL_GET_SOURCE_BY_SSRC,
SIGNAL_ON_NEW_SSRC,
SIGNAL_ON_SSRC_COLLISION,
SIGNAL_ON_SSRC_VALIDATED,
gobject_class->set_property = rtp_session_set_property;
gobject_class->get_property = rtp_session_get_property;
+ /**
+ * RTPSession::get-source-by-ssrc:
+ * @session: the object which received the signal
+ * @ssrc: the SSRC of the RTPSource
+ *
+ * Request the #RTPSource object with SSRC @ssrc in @session.
+ */
+ rtp_session_signals[SIGNAL_GET_SOURCE_BY_SSRC] =
+ g_signal_new ("get-source-by-ssrc", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (RTPSessionClass,
+ get_source_by_ssrc), NULL, NULL, gst_rtp_bin_marshal_OBJECT__UINT,
+ RTP_TYPE_SOURCE, 1, G_TYPE_UINT);
+
/**
* RTPSession::on-new-ssrc:
* @session: the object which received the signal
"The number of active sources in the session", 0, G_MAXUINT,
DEFAULT_NUM_ACTIVE_SOURCES, G_PARAM_READABLE));
+ klass->get_source_by_ssrc =
+ GST_DEBUG_FUNCPTR (rtp_session_get_source_by_ssrc);
+
GST_DEBUG_CATEGORY_INIT (rtp_session_debug, "rtpsession", 0, "RTP Session");
}
check_collision (RTPSession * sess, RTPSource * source,
RTPArrivalStats * arrival, gboolean rtp)
{
- /* If we have not arrival address, we can't do collision checking */
+ /* If we have no arrival address, we can't do collision checking */
if (!arrival->have_address)
return FALSE;
* This structure is used to account for addresses that have conflicted to find
* loops.
*/
-
typedef struct {
GstNetAddress address;
GstClockTime time;
struct _RTPSessionClass {
GObjectClass parent_class;
+ /* action signals */
+ RTPSource* (*get_source_by_ssrc) (RTPSession *sess, guint32 ssrc);
+
/* signals */
void (*on_new_ssrc) (RTPSession *sess, RTPSource *source);
void (*on_ssrc_collision) (RTPSession *sess, RTPSource *source);
RTPSource* rtp_session_create_source (RTPSession *sess);
/* processing packets from receivers */
-GstFlowReturn rtp_session_process_rtp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime);
-GstFlowReturn rtp_session_process_rtcp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time);
+GstFlowReturn rtp_session_process_rtp (RTPSession *sess, GstBuffer *buffer,
+ GstClockTime current_time, guint64 ntpnstime);
+GstFlowReturn rtp_session_process_rtcp (RTPSession *sess, GstBuffer *buffer,
+ GstClockTime current_time);
/* processing packets for sending */
-GstFlowReturn rtp_session_send_rtp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime);
+GstFlowReturn rtp_session_send_rtp (RTPSession *sess, GstBuffer *buffer,
+ GstClockTime current_time, guint64 ntpnstime);
/* stopping the session */
-GstFlowReturn rtp_session_send_bye (RTPSession *sess, const gchar *reason, GstClockTime current_time);
+GstFlowReturn rtp_session_send_bye (RTPSession *sess, const gchar *reason,
+ GstClockTime current_time);
/* get interval for next RTCP interval */
GstClockTime rtp_session_next_timeout (RTPSession *sess, GstClockTime current_time);
-GstFlowReturn rtp_session_on_timeout (RTPSession *sess, GstClockTime current_time, guint64 ntpnstime);
+GstFlowReturn rtp_session_on_timeout (RTPSession *sess, GstClockTime current_time,
+ guint64 ntpnstime);
#endif /* __RTP_SESSION_H__ */