mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
I'm too lazy to comment this
Original commit message from CVS: Patch written by Kai Vehmanen <kai.vehmanen@nokia.com> applied. See bug #325148.
This commit is contained in:
parent
98acdd1dc3
commit
d653e45ce4
2 changed files with 30 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2006-01-24 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
|
||||||
|
* gst/rtp/gstrtpg711pay.c:
|
||||||
|
Patch written by Kai Vehmanen <kai.vehmanen@nokia.com> applied. See
|
||||||
|
bug #325148.
|
||||||
|
|
||||||
2006-01-23 Edward Hervey <edward@fluendo.com>
|
2006-01-23 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps),
|
* gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* Copyright (C) <2005> Edgard Lima <edgard.lima@indt.org.br>
|
* Copyright (C) <2005> Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
* Copyright (C) <2005> Nokia Corporation <kai.vehmanen@nokia.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -63,6 +64,11 @@ static void gst_rtp_g711_pay_finalize (GObject * object);
|
||||||
GST_BOILERPLATE (GstRtpG711Pay, gst_rtp_g711_pay, GstBaseRTPPayload,
|
GST_BOILERPLATE (GstRtpG711Pay, gst_rtp_g711_pay, GstBaseRTPPayload,
|
||||||
GST_TYPE_BASE_RTP_PAYLOAD);
|
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
|
static void
|
||||||
gst_rtp_g711_pay_base_init (gpointer klass)
|
gst_rtp_g711_pay_base_init (gpointer klass)
|
||||||
{
|
{
|
||||||
|
@ -145,6 +151,16 @@ gst_rtp_g711_pay_flush (GstRtpG711Pay * rtpg711pay)
|
||||||
guint avail;
|
guint avail;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
GstFlowReturn ret;
|
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
|
/* the data available in the adapter is either smaller
|
||||||
* than the MTU or bigger. In the case it is smaller, the complete
|
* than the MTU or bigger. In the case it is smaller, the complete
|
||||||
|
@ -153,19 +169,20 @@ gst_rtp_g711_pay_flush (GstRtpG711Pay * rtpg711pay)
|
||||||
|
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
|
|
||||||
while (avail > 0) {
|
while (avail >= minptime_octets) {
|
||||||
guint towrite;
|
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
guint payload_len;
|
guint payload_len;
|
||||||
guint packet_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 */
|
/* fill one MTU or all available bytes */
|
||||||
towrite = MIN (packet_len, GST_BASE_RTP_PAYLOAD_MTU (rtpg711pay));
|
payload_len =
|
||||||
/* this is the payload length */
|
MIN (MIN (GST_BASE_RTP_PAYLOAD_MTU (rtpg711pay), maxptime_octets),
|
||||||
payload_len = gst_rtp_buffer_calc_payload_len (towrite, 0, 0);
|
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 */
|
/* create buffer to hold the payload */
|
||||||
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue