From 7ae45c5a353a3e6a32044263cb1a367f237e6505 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 28 Feb 2008 19:38:53 +0000 Subject: Fix bug sending empty packages and remove a buffer copy. --- audio/gstrtpsbcpay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'audio/gstrtpsbcpay.c') 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 >= -- cgit