summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtph263ppay.c
diff options
context:
space:
mode:
authorPhilippe Kalaf <philippe.kalaf@collabora.co.uk>2006-09-20 19:37:45 +0000
committerPhilippe Kalaf <philippe.kalaf@collabora.co.uk>2006-09-20 19:37:45 +0000
commitf1533c55045bffbb9716ddd5df348ceff7213fbd (patch)
tree6acaf1750ced42b129a4b4fe7b76bb15bfa20210 /gst/rtp/gstrtph263ppay.c
parente28d3b2a92e55ec9b24ba5a2aabf74460d327221 (diff)
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.
Diffstat (limited to 'gst/rtp/gstrtph263ppay.c')
-rw-r--r--gst/rtp/gstrtph263ppay.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c
index 952aa34b..fcc4d556 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);