Fix bug sending empty packages and remove a buffer copy.

This commit is contained in:
Luiz Augusto von Dentz 2008-02-28 19:38:53 +00:00
parent 68c897fe0f
commit 7ae45c5a35

View File

@ -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 >=