gboolean drop_null = self->drop_null;
gboolean ts_packet_size = 0;
guint ts_packet_count = 0;
- guint16 bits = 0;
guint8 npd_bits = 0;
gboolean num_packets_deleted = 0;
+ guint8 *data;
+ guint wordlen;
if (!self->drop_null && !self->add_seqnumext)
return gst_pad_push (self->srcpad, buffer);
goto error_mapped;
}
- bits = 0;
- bits |= drop_null << 15; /* N */
- bits |= self->add_seqnumext << 14; /* E */
+ gst_rtp_buffer_set_extension (&rtp, TRUE);
+ gst_rtp_buffer_set_extension_data (&rtp, 'R' << 8 | 'I', 1);
+ gst_rtp_buffer_get_extension_data (&rtp, NULL, (void **) &data, &wordlen);
+
+ data[0] = drop_null << 7;
+ data[0] |= self->add_seqnumext << 6;
if (ts_packet_count <= 7)
- bits |= (ts_packet_count & 7) << 10; /* Size */
- bits |= (ts_packet_size == 204) << 7; /* T */
- bits |= (npd_bits & 0x7F);
+ data[0] |= (ts_packet_count & 7) << 3; /* Size */
- gst_rtp_buffer_set_extension (&rtp, TRUE);
- gst_rtp_buffer_set_extension_data (&rtp, bits, self->add_seqnumext ? 1 : 0);
+ data[1] = (ts_packet_size == 204) << 7;
+ data[1] |= (npd_bits & 0x7F);
if (self->add_seqnumext) {
- guint8 *data;
- guint wordlen;
guint16 seqnum = gst_rtp_buffer_get_seq (&rtp);
guint32 extseqnum;
extseqnum = gst_rist_rtp_ext_seq (&self->extseqnum, seqnum);
- gst_rtp_buffer_get_extension_data (&rtp, &bits, (void **) &data, &wordlen);
- GST_WRITE_UINT16_BE (data, (extseqnum >> 16));
- data[2] = data[3] = 0;
+ GST_WRITE_UINT16_BE (data + 2, (extseqnum >> 16));
}
gst_rtp_buffer_unmap (&rtp);
gboolean has_drop_null;
guint orig_ts_packet_count;
gboolean ts_packet_size;
+ guint8 *data;
guint8 npd_bits;
fail_unless (gst_rtp_buffer_get_extension_data (rtp, &bits, &extdata,
&extlen));
- has_drop_null = (bits >> 15) & 1; /* N */
- has_seqnum_ext = (bits >> 14) & 1; /* E */
- orig_ts_packet_count = (bits >> 10) & 7; /* Size */
- ts_packet_size = ((bits >> 7) & 1) ? 204 : 188;
- npd_bits = bits & 0x7F;
+ fail_unless_equals_int (bits, 'R' << 8 | 'I');
+ fail_unless (extlen == 1);
+
+ data = extdata;
+
+ has_drop_null = (data[0] >> 7) & 1; /* N */
+ has_seqnum_ext = (data[0] >> 6) & 1; /* E */
+ orig_ts_packet_count = (data[0] >> 3) & 7; /* Size */
+ ts_packet_size = ((data[1] >> 7) & 1) ? 204 : 188;
+ npd_bits = data[1] & 0x7F;
fail_unless_equals_int (has_drop_null, wanted_has_drop_null);
fail_unless_equals_int (has_seqnum_ext, wanted_has_seqnum_ext);
if (wanted_has_seqnum_ext) {
guint16 ext;
- fail_unless (extlen == 1);
- ext = GST_READ_UINT16_BE (extdata);
-
+ ext = GST_READ_UINT16_BE (data + 2);
fail_unless_equals_int (ext, wanted_ext);
}
}