summaryrefslogtreecommitdiffstats
path: root/audio/gstrtpsbcpay.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-02-28 19:38:53 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-02-28 19:38:53 +0000
commit7ae45c5a353a3e6a32044263cb1a367f237e6505 (patch)
tree07661aa811ced5b0b8fffdc25120f72fdac94bc7 /audio/gstrtpsbcpay.c
parent68c897fe0f096be9898ffa8f7ec0150f1cb9f961 (diff)
Fix bug sending empty packages and remove a buffer copy.
Diffstat (limited to 'audio/gstrtpsbcpay.c')
-rw-r--r--audio/gstrtpsbcpay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/audio/gstrtpsbcpay.c b/audio/gstrtpsbcpay.c
index 39cf1970..33640c43 100644
--- a/audio/gstrtpsbcpay.c
+++ b/audio/gstrtpsbcpay.c
@@ -185,6 +185,8 @@ static GstFlowReturn gst_rtp_sbc_pay_flush_buffers(GstRtpSBCPay *sbcpay)
max_payload = MIN(max_payload, available);
frame_count = max_payload / sbcpay->frame_length;
payload_length = frame_count * sbcpay->frame_length;
+ if (payload_length == 0) /* Nothing to send */
+ return GST_FLOW_OK;
outbuf = gst_rtp_buffer_new_allocate(payload_length +
RTP_SBC_PAYLOAD_HEADER_SIZE, 0, 0);
@@ -219,7 +221,7 @@ static GstFlowReturn gst_rtp_sbc_pay_handle_buffer(GstBaseRTPPayload *payload,
sbcpay = GST_RTP_SBC_PAY(payload);
sbcpay->timestamp = GST_BUFFER_TIMESTAMP(buffer);
- gst_adapter_push(sbcpay->adapter, gst_buffer_copy(buffer));
+ gst_adapter_push(sbcpay->adapter, buffer);
available = gst_adapter_available(sbcpay->adapter);
if (available + RTP_SBC_HEADER_TOTAL >=