By moving variable declarations out of loop headers.
RTPHistItem *older;
RTPHistItem *newer;
guint32 timestamp_diff;
- gint seq_diff;
+ gint seq_diff, lost_packet_idx;
if (NULL == older_sibling) {
if (self->rtp_history->length == RTP_HISTORY_MAX_SIZE)
}
timestamp_diff = newer->timestamp - older->timestamp;
- for (gint lost_packet_idx = 1; lost_packet_idx < seq_diff; ++lost_packet_idx) {
+ for (lost_packet_idx = 1; lost_packet_idx < seq_diff; ++lost_packet_idx) {
guint32 lost_timestamp = older->timestamp +
lost_packet_idx * timestamp_diff / seq_diff;
if (lost_timestamp == timestamp) {
guint csrc_count = gst_rtp_buffer_get_csrc_count (red_rtp);
GstBuffer *ret = gst_rtp_buffer_new_allocate (0, 0, csrc_count);
GstRTPBuffer ret_rtp = GST_RTP_BUFFER_INIT;
+ guint i;
if (!gst_rtp_buffer_map (ret, GST_MAP_WRITE, &ret_rtp))
g_assert_not_reached ();
gst_rtp_buffer_set_seq (&ret_rtp, seq_num);
gst_rtp_buffer_set_timestamp (&ret_rtp, timestamp);
gst_rtp_buffer_set_ssrc (&ret_rtp, gst_rtp_buffer_get_ssrc (red_rtp));
- for (guint i = 0; i < csrc_count; ++i)
+ for (i = 0; i < csrc_count; ++i)
gst_rtp_buffer_set_csrc (&ret_rtp, i, gst_rtp_buffer_get_csrc (red_rtp, i));
gst_rtp_buffer_unmap (&ret_rtp);
GstBuffer *red = gst_rtp_buffer_new_allocate (red_header_size, 0, csrc_count);
guint8 *red_block_header;
GstRTPBuffer red_rtp = GST_RTP_BUFFER_INIT;
+ guint i;
if (!gst_rtp_buffer_map (red, GST_MAP_WRITE, &red_rtp))
g_assert_not_reached ();
gst_rtp_buffer_set_seq (&red_rtp, gst_rtp_buffer_get_seq (inp_rtp));
gst_rtp_buffer_set_timestamp (&red_rtp, timestmap);
gst_rtp_buffer_set_ssrc (&red_rtp, gst_rtp_buffer_get_ssrc (inp_rtp));
- for (guint i = 0; i != csrc_count; ++i)
+ for (i = 0; i != csrc_count; ++i)
gst_rtp_buffer_set_csrc (&red_rtp, i,
gst_rtp_buffer_get_csrc ((inp_rtp), i));
guint8 fec_pt, guint16 lost_seq)
{
guint fec_packets = 0;
+ gsize i;
g_assert (NULL == self->info_media);
g_assert (0 == self->info_fec->len);
g_array_set_size (self->info_arr, gst_buffer_list_length (buflist));
- for (gsize i = 0;
+ for (i = 0;
i < gst_buffer_list_length (buflist) && !self->lost_packet_from_storage;
++i) {
GstBuffer *buffer = gst_buffer_list_get (buflist, i);
guint16 fec_seq_base)
{
guint64 mask = 0;
- for (GList * it = self->info_media; it; it = it->next) {
+ GList *it;
+
+ for (it = self->info_media; it; it = it->next) {
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
mask |=
rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
gst_rtp_ulpfec_dec_is_recovered_pt_valid (GstRtpUlpFecDec * self, gint media_pt,
guint8 recovered_pt)
{
+ GList *it;
if (media_pt == recovered_pt)
return TRUE;
- for (GList * it = self->info_media; it; it = it->next) {
+ for (it = self->info_media; it; it = it->next) {
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
if (gst_rtp_buffer_get_payload_type (&info->rtp) == recovered_pt)
return TRUE;
gboolean fec_mask_long = rtp_ulpfec_buffer_get_fechdr (&info_fec->rtp)->L;
guint16 fec_seq_base = rtp_ulpfec_buffer_get_seq_base (&info_fec->rtp);
GstBuffer *ret;
+ GList *it;
g_array_set_size (self->scratch_buf, 0);
rtp_buffer_to_ulpfec_bitstring (&info_fec->rtp, self->scratch_buf, TRUE,
fec_mask_long);
- for (GList * it = self->info_media; it; it = it->next) {
+ for (it = self->info_media; it; it = it->next) {
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
guint64 packet_mask =
rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
{
guint64 media_mask = 0;
gint media_mask_seq_base = -1;
+ gsize i;
if (self->lost_packet_from_storage)
return gst_rtp_ulpfec_dec_recover_from_storage (self, dst_pt, dst_seq);
/* Looking for a FEC packet which can be used for recovery */
- for (gsize i = 0; i < self->info_fec->len; ++i) {
+ for (i = 0; i < self->info_fec->len; ++i) {
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self,
g_ptr_array_index (self->info_fec, i));
guint16 seq_base = rtp_ulpfec_buffer_get_seq_base (&info->rtp);
GQueue * packets, guint fec_packets)
{
GList *it = packets->tail;
+ guint i;
g_array_set_size (ctx->info_arr, packets->length);
- for (guint i = 0; i < packets->length; ++i) {
+ for (i = 0; i < packets->length; ++i) {
GstBuffer *buffer = it->data;
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (ctx, i);
guint len = end - start + 1;
guint64 mask = 0;
guint16 seq_base = 0;
+ guint i;
len = MIN (len, RTP_ULPFEC_PROTECTED_PACKETS_MAX (TRUE));
end = start + len - 1;
- for (guint i = start; i <= end; ++i) {
+ for (i = start; i <= end; ++i) {
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (ctx, i);
guint16 seq = gst_rtp_buffer_get_seq (&info->rtp);
GstBuffer *ret;
guint64 tmp_mask;
gboolean fec_mask_long;
+ guint i;
if (ctx->fec_packet_idx >= ctx->fec_packets)
return NULL;
tmp_mask = fec_mask;
fec_mask_long = rtp_ulpfec_mask_is_long (fec_mask);
- for (guint i = start; i <= end; ++i) {
+ for (i = start; i <= end; ++i) {
RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (ctx, i);
guint64 packet_mask =
rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
}
}
- for (guint i = 0; i < too_old_buffers_num; ++i) {
+ for (i = 0; i < too_old_buffers_num; ++i) {
RtpStorageItem *item = g_queue_pop_tail (&stream->queue);
rtp_storage_item_free (item);
}
GList *end = NULL;
GList *start = NULL;
gboolean saw_fec = TRUE; /* To initialize the start pointer in the loop below */
+ GList *it;
/* Looking for media stream chunk with FEC packets at the end, which could
* can have the lost packet. For example:
* - it could have arrived right after it was considered lost (more of a corner case)
* - it was recovered together with the other lost packet (most likely)
*/
- for (GList * it = stream->queue.tail; it; it = it->prev) {
+ for (it = stream->queue.tail; it; it = it->prev) {
RtpStorageItem *item = it->data;
gboolean found_end = FALSE;
if (start && end) {
GstBufferList *ret = gst_buffer_list_new_sized (ret_length);
+ GList *it;
- for (GList * it = start; it != end->prev; it = it->prev)
+ for (it = start; it != end->prev; it = it->prev)
gst_buffer_list_add (ret,
gst_buffer_ref (((RtpStorageItem *) it->data)->buffer));
return ret;
rtp_storage_stream_get_redundant_packet (RtpStorageStream * stream,
guint16 lost_seq)
{
- for (GList * it = stream->queue.head; it; it = it->next) {
+ GList *it;
+ for (it = stream->queue.head; it; it = it->next) {
RtpStorageItem *item = it->data;
if (item->seq == lost_seq)
return gst_buffer_ref (item->buffer);
#define _check_caps(_h_, _nth_, _expected_payload_) \
G_STMT_START { \
GstEvent *_ev_; \
- gint _pt_ = -1; \
+ gint _pt_ = -1, _i_; \
GstCaps *_caps_ = NULL; \
\
- for (gint _i_ = 0; _i_ < _nth_; ++_i_) \
+ for (_i_ = 0; _i_ < _nth_; ++_i_) \
gst_event_unref (gst_harness_pull_event (_h_)); \
\
_ev_ = gst_harness_pull_event (_h_); \
{
gboolean found = FALSE;
GstRTPBuffer rtp = { NULL };
+ GList *it;
fail_unless (gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp));
- for (GList * it = infos; it; it = it->next) {
+ for (it = infos; it; it = it->next) {
RecoveredPacketInfo *info = it->data;
if (gst_rtp_buffer_get_seq (&rtp) == info->seq) {
fail_unless_equals_int (gst_rtp_buffer_get_payload_type (&rtp), info->pt);
gsize lost_packet_size = packets_size[__i__];
RecoveredPacketInfo info = {.pt = 126,.ssrc = 578322839,.seq = lost_seq };
GList *expected = expect_recovered_packets (h, &info, 1);
+ gsize i;
- for (gsize i = 0; i < G_N_ELEMENTS (packets); ++i) {
+ for (i = 0; i < G_N_ELEMENTS (packets); ++i) {
if (i != (gsize) __i__)
push_data (h, packets[i], packets_size[i]);
}