mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
rtp: Fix compilation with non-C99 compilers
By moving variable declarations out of loop headers.
This commit is contained in:
parent
7f9d468c29
commit
ed2ccb1a60
7 changed files with 36 additions and 20 deletions
|
@ -218,7 +218,7 @@ gst_red_history_lost_seq_num_for_timestamp (GstRtpRedDec * self,
|
|||
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)
|
||||
|
@ -260,7 +260,7 @@ gst_red_history_lost_seq_num_for_timestamp (GstRtpRedDec * self,
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -283,6 +283,7 @@ gst_rtp_red_create_packet (GstRtpRedDec * self, GstRTPBuffer * red_rtp,
|
|||
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 ();
|
||||
|
||||
|
@ -291,7 +292,7 @@ gst_rtp_red_create_packet (GstRtpRedDec * self, GstRTPBuffer * red_rtp,
|
|||
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);
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ _alloc_red_packet_and_fill_headers (GstRtpRedEnc * self,
|
|||
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 ();
|
||||
|
@ -156,7 +157,7 @@ _alloc_red_packet_and_fill_headers (GstRtpRedEnc * self,
|
|||
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));
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ gst_rtp_ulpfec_dec_start (GstRtpUlpFecDec * self, GstBufferList * buflist,
|
|||
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);
|
||||
|
@ -112,7 +113,7 @@ gst_rtp_ulpfec_dec_start (GstRtpUlpFecDec * self, GstBufferList * buflist,
|
|||
|
||||
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);
|
||||
|
@ -165,7 +166,9 @@ gst_rtp_ulpfec_dec_get_media_buffers_mask (GstRtpUlpFecDec * self,
|
|||
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),
|
||||
|
@ -178,10 +181,11 @@ static gboolean
|
|||
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;
|
||||
|
@ -198,12 +202,13 @@ gst_rtp_ulpfec_dec_recover_from_fec (GstRtpUlpFecDec * self,
|
|||
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),
|
||||
|
@ -305,12 +310,13 @@ gst_rtp_ulpfec_dec_recover (GstRtpUlpFecDec * self, guint32 ssrc, gint media_pt,
|
|||
{
|
||||
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);
|
||||
|
|
|
@ -120,10 +120,11 @@ gst_rtp_ulpfec_enc_stream_ctx_start (GstRtpUlpFecEncStreamCtx * ctx,
|
|||
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);
|
||||
|
||||
|
@ -162,11 +163,12 @@ static void
|
|||
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);
|
||||
|
||||
|
@ -200,6 +202,7 @@ gst_rtp_ulpfec_enc_stream_ctx_protect (GstRtpUlpFecEncStreamCtx * ctx,
|
|||
GstBuffer *ret;
|
||||
guint64 tmp_mask;
|
||||
gboolean fec_mask_long;
|
||||
guint i;
|
||||
|
||||
if (ctx->fec_packet_idx >= ctx->fec_packets)
|
||||
return NULL;
|
||||
|
@ -210,7 +213,7 @@ gst_rtp_ulpfec_enc_stream_ctx_protect (GstRtpUlpFecEncStreamCtx * ctx,
|
|||
|
||||
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),
|
||||
|
|
|
@ -72,7 +72,7 @@ rtp_storage_stream_resize (RtpStorageStream * stream, GstClockTime size_time)
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ rtp_storage_stream_get_packets_for_recovery (RtpStorageStream * stream,
|
|||
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:
|
||||
|
@ -151,7 +152,7 @@ rtp_storage_stream_get_packets_for_recovery (RtpStorageStream * stream,
|
|||
* - 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;
|
||||
|
||||
|
@ -193,8 +194,9 @@ rtp_storage_stream_get_packets_for_recovery (RtpStorageStream * stream,
|
|||
|
||||
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;
|
||||
|
@ -207,7 +209,8 @@ GstBuffer *
|
|||
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);
|
||||
|
|
|
@ -49,10 +49,10 @@
|
|||
#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_); \
|
||||
|
|
|
@ -144,10 +144,11 @@ packet_recovered_cb (GObject * internal_storage, GstBuffer * buffer,
|
|||
{
|
||||
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);
|
||||
|
@ -285,8 +286,9 @@ GST_START_TEST (rtpulpfecdec_recovered_from_many)
|
|||
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]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue