From: <al...@fr...> - 2006-01-24 18:06:20
|
CVS Root: /cvs/gstreamer Module: gst-plugins-good Changes by: alima Date: Tue Jan 24 2006 10:03:58 PST Log message: Patch written by Kai Vehmanen <kai...@no...> applied. See bug #325148. Modified files: . : ChangeLog gst/rtp : gstrtpg711pay.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.2103&r2=1.2104 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/rtp/gstrtpg711pay.c.diff?r1=1.7&r2=1.8 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v retrieving revision 1.2103 retrieving revision 1.2104 diff -u -d -r1.2103 -r1.2104 --- ChangeLog 23 Jan 2006 18:39:30 -0000 1.2103 +++ ChangeLog 24 Jan 2006 18:03:46 -0000 1.2104 @@ -1,3 +1,9 @@ +2006-01-24 Edgard Lima <edg...@in...> + + * gst/rtp/gstrtpg711pay.c: + Patch written by Kai Vehmanen <kai...@no...> applied. See + bug #325148. 2006-01-23 Edward Hervey <ed...@fl...> * gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps), Index: gstrtpg711pay.c RCS file: /cvs/gstreamer/gst-plugins-good/gst/rtp/gstrtpg711pay.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- gstrtpg711pay.c 3 Dec 2005 18:51:48 -0000 1.7 +++ gstrtpg711pay.c 24 Jan 2006 18:03:46 -0000 1.8 @@ -1,6 +1,7 @@ /* GStreamer * Copyright (C) <1999> Erik Walthinsen <om...@cs...> * Copyright (C) <2005> Edgard Lima <edg...@in...> + * Copyright (C) <2005> Nokia Corporation <kai...@no...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -63,6 +64,11 @@ GST_BOILERPLATE (GstRtpG711Pay, gst_rtp_g711_pay, GstBaseRTPPayload, GST_TYPE_BASE_RTP_PAYLOAD); +/* The lower limit for number of octet to put in one packet + * (clock-rate=8000, octet-per-sample=1). The default 80 is equal + * to to 10msec (see RFC3551) */ +#define GST_RTP_G711_MIN_PTIME_OCTETS 80 static void gst_rtp_g711_pay_base_init (gpointer klass) { @@ -145,6 +151,16 @@ guint avail; GstBuffer *outbuf; GstFlowReturn ret; + guint maxptime_octets = G_MAXUINT; + guint minptime_octets = GST_RTP_G711_MIN_PTIME_OCTETS; + if (GST_BASE_RTP_PAYLOAD (rtpg711pay)->max_ptime > 0) { + /* calculate octet count with: + maxptime-nsec * samples-per-sec / nsecs-per-sec * octets-per-sample */ + maxptime_octets = + GST_BASE_RTP_PAYLOAD (rtpg711pay)->max_ptime * + GST_BASE_RTP_PAYLOAD (rtpg711pay)->clock_rate / GST_SECOND; + } /* the data available in the adapter is either smaller * than the MTU or bigger. In the case it is smaller, the complete @@ -153,19 +169,20 @@ ret = GST_FLOW_OK; - while (avail > 0) { - guint towrite; + while (avail >= minptime_octets) { guint8 *payload; guint8 *data; guint payload_len; guint packet_len; - /* this will be the total lenght of the packet */ - packet_len = gst_rtp_buffer_calc_packet_len (avail, 0, 0); /* fill one MTU or all available bytes */ - towrite = MIN (packet_len, GST_BASE_RTP_PAYLOAD_MTU (rtpg711pay)); - /* this is the payload length */ - payload_len = gst_rtp_buffer_calc_payload_len (towrite, 0, 0); + payload_len = + MIN (MIN (GST_BASE_RTP_PAYLOAD_MTU (rtpg711pay), maxptime_octets), + avail); + /* this will be the total lenght of the packet */ + packet_len = gst_rtp_buffer_calc_packet_len (payload_len, 0, 0); /* create buffer to hold the payload */ outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); |