~ubuntu-branches/ubuntu/karmic/farsight2/karmic

« back to all changes in this revision

Viewing changes to gst/rtcpfilter/fs-rtcp-filter.c

  • Committer: Bazaar Package Importer
  • Author(s): Sjoerd Simons
  • Date: 2009-05-29 12:20:24 UTC
  • mfrom: (1.1.4 upstream) (2.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090529122024-w0uzozcjda8zsul7
Tags: 0.0.12-1
New Upstream Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
#include <gst/rtp/gstrtcpbuffer.h>
40
40
 
 
41
#include <string.h>
 
42
 
41
43
GST_DEBUG_CATEGORY (rtcp_filter_debug);
42
44
#define GST_CAT_DEFAULT (rtcp_filter_debug)
43
45
 
197
199
    GstRTCPPacket packet;
198
200
    gboolean modified = FALSE;
199
201
 
200
 
    gst_rtcp_buffer_get_first_packet (buf, &packet);
201
 
 
202
 
    for (;;)
 
202
    if (gst_rtcp_buffer_get_first_packet (buf, &packet))
203
203
    {
204
 
      if (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_SR)
205
 
      {
206
 
        if (!gst_rtcp_packet_remove (&packet))
207
 
          break;
208
 
        modified = TRUE;
209
 
      }
210
 
      else
211
 
      {
212
 
        if (!gst_rtcp_packet_move_to_next (&packet))
213
 
          break;
 
204
      for (;;)
 
205
      {
 
206
        if (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_SR)
 
207
        {
 
208
          GstRTCPPacket nextpacket = packet;
 
209
 
 
210
          modified = TRUE;
 
211
          gst_rtcp_packet_move_to_next (&nextpacket);
 
212
          if (gst_rtcp_packet_get_type (&nextpacket) == GST_RTCP_TYPE_RR)
 
213
          {
 
214
            if (!gst_rtcp_packet_remove (&packet))
 
215
              break;
 
216
          }
 
217
          else
 
218
          {
 
219
            guchar *data = GST_BUFFER_DATA (buf) + packet.offset;
 
220
 
 
221
            /* If there is no RR, lets add an empty one */
 
222
            data[0] = (GST_RTCP_VERSION << 6);
 
223
            data[1] = GST_RTCP_TYPE_RR;
 
224
            data[2] = 0;
 
225
            data[3] = 1;
 
226
            memmove (GST_BUFFER_DATA (buf) + packet.offset + 8,
 
227
                GST_BUFFER_DATA (buf) + nextpacket.offset,
 
228
                GST_BUFFER_SIZE (buf) - nextpacket.offset);
 
229
            gst_rtcp_buffer_get_first_packet (buf, &packet);
 
230
          }
 
231
 
 
232
        }
 
233
        else
 
234
        {
 
235
          if (!gst_rtcp_packet_move_to_next (&packet))
 
236
            break;
 
237
        }
214
238
      }
215
239
    }
216
240