From f1533c55045bffbb9716ddd5df348ceff7213fbd Mon Sep 17 00:00:00 2001 From: Philippe Kalaf Date: Wed, 20 Sep 2006 19:37:45 +0000 Subject: [PATCH] gst/rtp/: Correctly calculate size of each H263+ RTP buffer taking into account MTU and Original commit message from CVS: * gst/rtp/gstrtph263pdepay.c: * gst/rtp/gstrtph263ppay.c: Correctly calculate size of each H263+ RTP buffer taking into account MTU and RTP header. --- ChangeLog | 7 +++++++ gst/rtp/gstrtph263pdepay.c | 1 + gst/rtp/gstrtph263ppay.c | 20 ++++++++++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0885c1..6116706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-09-20 Philippe Kalaf + + * gst/rtp/gstrtph263pdepay.c: + * gst/rtp/gstrtph263ppay.c: + Correctly calculate size of each H263+ RTP buffer taking into account MTU and + RTP header. + 2006-09-20 Wim Taymans * gst/rtp/Makefile.am: diff --git a/gst/rtp/gstrtph263pdepay.c b/gst/rtp/gstrtph263pdepay.c index 5494c26..fcca841 100644 --- a/gst/rtp/gstrtph263pdepay.c +++ b/gst/rtp/gstrtph263pdepay.c @@ -205,6 +205,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) payload[header_len + 1] = 0; } + /* FIXME do not ignore the VRC header (See RFC 2429 section 4.2) */ /* strip off header */ payload += header_len; payload_len -= header_len; diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c index 952aa34..fcc4d55 100644 --- a/gst/rtp/gstrtph263ppay.c +++ b/gst/rtp/gstrtph263ppay.c @@ -163,6 +163,14 @@ gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay) fragmented = FALSE; + /* This algorithm assumes the H263+ encoder sends complete frames in each + * buffer */ + /* This algorithm implements the Follow-on packets method for packetization. + * This assumes low packet loss network. A more resilient method would be to + * separate large frames at synchronisation points (Segments) (See RFC 2429 + * section 6). It would be interesting to have a property such as network + * quality to select between both packetization methods */ + /* TODO Add VRC supprt (See RFC 2429 section 4.2) */ while (avail > 0) { guint towrite; guint8 *payload; @@ -170,13 +178,13 @@ gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay) guint payload_len; gint header_len; - /* FIXME, do better mtu packing, header len etc should be - * included in this calculation. */ - towrite = MIN (avail, GST_BASE_RTP_PAYLOAD_MTU (rtph263ppay)); - /* for fragmented frames we need 2 bytes header, for other - * frames we must reuse the first 2 bytes of the data as the - * header */ + /* for picture start frames (non-fragmented), we need to remove the first + * two 0x00 bytes and set P=1 */ header_len = (fragmented ? 2 : 0); + + towrite = MIN (avail, gst_rtp_buffer_calc_payload_len + (GST_BASE_RTP_PAYLOAD_MTU (rtph263ppay) - header_len, 0, 0)); + payload_len = header_len + towrite; outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); -- 2.7.4