rtp: fix marshallers

Remove custom marshallers for minobject.
Init RTCP buffer correctly.
Handle results from setcaps
Remove asserts.
This commit is contained in:
Wim Taymans 2011-12-09 10:51:14 +01:00
parent 7f51236346
commit 439e2f1cfd
7 changed files with 21 additions and 97 deletions

View file

@ -8,3 +8,5 @@ VOID:UINT,UINT
VOID:OBJECT,OBJECT
UINT64:BOOL,UINT64
VOID:UINT64
BOOL:BOXED,BOOL
VOID:UINT,UINT,UINT,UINT,BOXED

View file

@ -1304,7 +1304,7 @@ gst_rtp_bin_handle_sync (GstElement * jitterbuffer, GstStructure * s,
guint64 clock_base;
guint64 extrtptime;
GstBuffer *buffer;
GstRTCPBuffer rtcp = { NULL };
GstRTCPBuffer rtcp = { NULL, };
bin = stream->bin;

View file

@ -1245,7 +1245,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
gboolean tail;
gint percent = -1;
guint8 pt;
GstRTPBuffer rtp = { NULL };
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
@ -1522,7 +1522,7 @@ compute_elapsed (GstRtpJitterBuffer * jitterbuffer, GstBuffer * outbuf)
guint64 ext_time, elapsed;
guint32 rtp_time;
GstRtpJitterBufferPrivate *priv;
GstRTPBuffer rtp = { NULL };
GstRTPBuffer rtp = { NULL, };
priv = jitterbuffer->priv;
gst_rtp_buffer_map (outbuf, GST_MAP_READ, &rtp);
@ -1569,7 +1569,7 @@ gst_rtp_jitter_buffer_loop (GstRtpJitterBuffer * jitterbuffer)
GstClockID id;
GstClockTime sync_time;
gint percent = -1;
GstRTPBuffer rtp = { NULL };
GstRTPBuffer rtp = { NULL, };
priv = jitterbuffer->priv;
@ -1958,7 +1958,7 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstObject * parent,
guint64 ext_rtptime, diff;
guint32 rtptime;
gboolean drop = FALSE;
GstRTCPBuffer rtcp = { NULL };
GstRTCPBuffer rtcp = { NULL, };
guint64 clock_base;
jitterbuffer = GST_RTP_JITTER_BUFFER (parent);

View file

@ -1335,7 +1335,7 @@ gst_rtp_session_event_recv_rtp_sink (GstPad * pad, GstObject * parent,
/* process */
gst_event_parse_caps (event, &caps);
gst_rtp_session_sink_setcaps (pad, caps);
ret = gst_rtp_session_sink_setcaps (pad, caps);
/* and eat */
gst_event_unref (event);
break;
@ -1660,7 +1660,7 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstObject * parent,
/* process */
gst_event_parse_caps (event, &caps);
gst_rtp_session_setcaps_send_rtp (pad, caps);
ret = gst_rtp_session_setcaps_send_rtp (pad, caps);
/* and eat */
gst_event_unref (event);
break;

View file

@ -509,7 +509,7 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GstRtpSsrcDemux *demux;
guint32 ssrc;
GstRtpSsrcDemuxPad *dpad;
GstRTPBuffer rtp = {NULL};
GstRTPBuffer rtp = { NULL };
GstPad *srcpad;
demux = GST_RTP_SSRC_DEMUX (parent);
@ -566,7 +566,7 @@ gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstObject * parent,
guint32 ssrc;
GstRtpSsrcDemuxPad *dpad;
GstRTCPPacket packet;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
GstPad *srcpad;
demux = GST_RTP_SSRC_DEMUX (parent);

View file

@ -131,75 +131,6 @@ accumulate_trues (GSignalInvocationHint * ihint, GValue * return_accu,
return TRUE;
}
static void
gst_rtp_bin_marshal_BOOLEAN__MINIOBJECT_BOOLEAN (GClosure * closure,
GValue * return_value G_GNUC_UNUSED, guint n_param_values,
const GValue * param_values, gpointer invocation_hint G_GNUC_UNUSED,
gpointer marshal_data)
{
typedef gboolean (*GMarshalFunc_BOOLEAN__MINIOBJECT_BOOLEAN) (gpointer data1,
gpointer arg_1, gboolean arg_2, gpointer data2);
register GMarshalFunc_BOOLEAN__MINIOBJECT_BOOLEAN callback;
register GCClosure *cc = (GCClosure *) closure;
register gpointer data1, data2;
gboolean v_return;
g_return_if_fail (return_value != NULL);
g_return_if_fail (n_param_values == 3);
if (G_CCLOSURE_SWAP_DATA (closure)) {
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
} else {
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback =
(GMarshalFunc_BOOLEAN__MINIOBJECT_BOOLEAN) (marshal_data ? marshal_data :
cc->callback);
v_return = callback (data1,
g_value_get_boxed (param_values + 1),
g_value_get_boolean (param_values + 2), data2);
g_value_set_boolean (return_value, v_return);
}
static void
gst_rtp_bin_marshal_VOID__UINT_UINT_UINT_UINT_MINIOBJECT (GClosure * closure,
GValue * return_value G_GNUC_UNUSED, guint n_param_values,
const GValue * param_values, gpointer invocation_hint G_GNUC_UNUSED,
gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__UINT_UINT_UINT_UINT_MINIOBJECT) (gpointer
data1, guint arg_1, guint arg_2, guint arg_3, guint arg_4, gpointer arg_5,
gpointer data2);
register GMarshalFunc_VOID__UINT_UINT_UINT_UINT_MINIOBJECT callback;
register GCClosure *cc = (GCClosure *) closure;
register gpointer data1, data2;
g_return_if_fail (n_param_values == 6);
if (G_CCLOSURE_SWAP_DATA (closure)) {
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
} else {
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback =
(GMarshalFunc_VOID__UINT_UINT_UINT_UINT_MINIOBJECT) (marshal_data ?
marshal_data : cc->callback);
callback (data1,
g_value_get_uint (param_values + 1),
g_value_get_uint (param_values + 2),
g_value_get_uint (param_values + 3),
g_value_get_uint (param_values + 4),
g_value_get_boxed (param_values + 5), data2);
}
static void
rtp_session_class_init (RTPSessionClass * klass)
{
@ -348,8 +279,9 @@ rtp_session_class_init (RTPSessionClass * klass)
rtp_session_signals[SIGNAL_ON_SENDING_RTCP] =
g_signal_new ("on-sending-rtcp", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_sending_rtcp),
accumulate_trues, NULL, gst_rtp_bin_marshal_BOOLEAN__MINIOBJECT_BOOLEAN,
G_TYPE_BOOLEAN, 2, GST_TYPE_BUFFER, G_TYPE_BOOLEAN);
accumulate_trues, NULL, gst_rtp_bin_marshal_BOOLEAN__BOXED_BOOLEAN,
G_TYPE_BOOLEAN, 2, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_BOOLEAN);
/**
* RTPSession::on-feedback-rtcp:
@ -364,11 +296,10 @@ rtp_session_class_init (RTPSessionClass * klass)
*
* Notify that a RTCP feedback packet has been received
*/
rtp_session_signals[SIGNAL_ON_FEEDBACK_RTCP] =
g_signal_new ("on-feedback-rtcp", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_feedback_rtcp),
NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_UINT_UINT_UINT_MINIOBJECT,
NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_UINT_UINT_UINT_BOXED,
G_TYPE_NONE, 5, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
GST_TYPE_BUFFER);
@ -2360,7 +2291,7 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer,
gboolean more, is_bye = FALSE, do_sync = FALSE;
RTPArrivalStats arrival;
GstFlowReturn result = GST_FLOW_OK;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
@ -2758,7 +2689,7 @@ session_start_rtcp (RTPSession * sess, ReportData * data)
{
GstRTCPPacket *packet = &data->packet;
RTPSource *own = sess->source;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
data->rtcp = gst_rtcp_buffer_new (sess->mtu);
@ -2941,7 +2872,7 @@ session_sdes (RTPSession * sess, ReportData * data)
GstRTCPPacket *packet = &data->packet;
const GstStructure *sdes;
gint i, n_fields;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
gst_rtcp_buffer_map (data->rtcp, GST_MAP_WRITE, &rtcp);
@ -3009,7 +2940,7 @@ static void
session_bye (RTPSession * sess, ReportData * data)
{
GstRTCPPacket *packet = &data->packet;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
/* open packet */
session_start_rtcp (sess, data);
@ -3364,7 +3295,7 @@ static gboolean
has_pli_compare_func (gconstpointer a, gconstpointer ignored)
{
GstRTCPPacket packet;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
gboolean ret = FALSE;
gst_rtcp_buffer_map ((GstBuffer *) a, GST_MAP_READ, &rtcp);
@ -3389,7 +3320,7 @@ rtp_session_on_sending_rtcp (RTPSession * sess, GstBuffer * buffer,
gpointer key, value;
gboolean started_fir = FALSE;
GstRTCPPacket fir_rtcppacket;
GstRTCPBuffer rtcp;
GstRTCPBuffer rtcp = { NULL, };
RTP_SESSION_LOCK (sess);

View file

@ -1037,11 +1037,6 @@ rtp_source_process_rtp (RTPSource * src, GstBuffer * buffer,
seqnr = gst_rtp_buffer_get_seq (&rtp);
gst_rtp_buffer_unmap (&rtp);
/* FIXME-0.11
* would be nice to be able to pass along with buffer */
g_assert_not_reached ();
/* rtp_source_update_caps (src, GST_BUFFER_CAPS (buffer)); */
if (stats->cycles == -1) {
GST_DEBUG ("received first buffer");
/* first time we heard of this source */
@ -1223,10 +1218,6 @@ rtp_source_send_rtp (RTPSource * src, gpointer data, gboolean is_list,
buffer = GST_BUFFER_CAST (data);
}
/* FIXME-0.11 */
g_assert_not_reached ();
/* rtp_source_update_caps (src, GST_BUFFER_CAPS (buffer)); */
/* we are a sender now */
src->is_sender = TRUE;