summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpL16pay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-10-29 18:28:25 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-10-29 18:28:25 +0000
commit38eac47ec90296a1f3f3a09ec15633b20b672616 (patch)
tree7b3662449e479ac9e2bd25566ed4915960df0e13 /gst/rtp/gstrtpL16pay.c
parentb29385bd76388904ba203360e1533c903a369ab4 (diff)
gst/rtp/gstrtpL16pay.c: Only put an integral amount of samples in the RTP packet.
Original commit message from CVS: * gst/rtp/gstrtpL16pay.c: (gst_rtp_L16_pay_flush), (gst_rtp_L16_pay_getcaps): Only put an integral amount of samples in the RTP packet. Fixes #556641.
Diffstat (limited to 'gst/rtp/gstrtpL16pay.c')
-rw-r--r--gst/rtp/gstrtpL16pay.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c
index 2b5f250b..f361ef39 100644
--- a/gst/rtp/gstrtpL16pay.c
+++ b/gst/rtp/gstrtpL16pay.c
@@ -245,6 +245,10 @@ gst_rtp_L16_pay_flush (GstRtpL16Pay * rtpL16pay, guint len)
guint samples;
GstClockTime duration;
+ /* calculate the amount of samples and round down the length */
+ samples = len / (2 * rtpL16pay->channels);
+ len = samples * (2 * rtpL16pay->channels);
+
/* now alloc output buffer */
outbuf = gst_rtp_buffer_new_allocate (len, 0, 0);
@@ -255,7 +259,6 @@ gst_rtp_L16_pay_flush (GstRtpL16Pay * rtpL16pay, guint len)
gst_adapter_copy (rtpL16pay->adapter, payload, 0, len);
gst_adapter_flush (rtpL16pay->adapter, len);
- samples = len / (2 * rtpL16pay->channels);
duration = gst_util_uint64_scale_int (samples, GST_SECOND, rtpL16pay->rate);
GST_BUFFER_TIMESTAMP (outbuf) = rtpL16pay->first_ts;
@@ -348,7 +351,6 @@ gst_rtp_L16_pay_getcaps (GstBaseRTPPayload * rtppayload, GstPad * pad)
}
gst_caps_unref (otherpadcaps);
}
-
return caps;
}