summaryrefslogtreecommitdiff
path: root/gst/siren/gstsirenenc.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-09-04 12:40:07 +0200
committerWim Taymans <wim@metal.(none)>2009-09-04 12:43:48 +0200
commitef999c5df7e3edf825187a7727acd0a1dddfdfbd (patch)
tree5416bcead7c5d0a2a2e36149b4ebfd699e583dff /gst/siren/gstsirenenc.c
parentb60d71482ffe47486fa300eb83bc0e3f15a8b837 (diff)
downloadgstreamer-plugins-bad-ef999c5df7e3edf825187a7727acd0a1dddfdfbd.tar.gz
sirenenc: cleanups
Diffstat (limited to 'gst/siren/gstsirenenc.c')
-rw-r--r--gst/siren/gstsirenenc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gst/siren/gstsirenenc.c b/gst/siren/gstsirenenc.c
index b0dfbc64d..9b6a2a8b2 100644
--- a/gst/siren/gstsirenenc.c
+++ b/gst/siren/gstsirenenc.c
@@ -209,7 +209,7 @@ gst_siren_enc_sink_event (GstPad * pad, GstEvent * event)
static GstFlowReturn
gst_siren_enc_chain (GstPad * pad, GstBuffer * buf)
{
- GstSirenEnc *enc = GST_SIREN_ENC (gst_pad_get_parent_element (pad));
+ GstSirenEnc *enc;
GstFlowReturn ret = GST_FLOW_OK;
GstBuffer *out_buf;
guint8 *in_data, *out_data;
@@ -221,6 +221,8 @@ gst_siren_enc_chain (GstPad * pad, GstBuffer * buf)
GstClockTime timestamp;
guint64 distance;
+ enc = GST_SIREN_ENC (GST_PAD_PARENT (pad));
+
discont = GST_BUFFER_IS_DISCONT (buf);
if (discont) {
GST_DEBUG_OBJECT (enc, "received DISCONT, flush adapter");
@@ -230,11 +232,11 @@ gst_siren_enc_chain (GstPad * pad, GstBuffer * buf)
gst_adapter_push (enc->adapter, buf);
- GST_LOG_OBJECT (enc, "Received buffer of size %d with adapter of size : %d",
- GST_BUFFER_SIZE (buf), gst_adapter_available (enc->adapter));
-
size = gst_adapter_available (enc->adapter);
+ GST_LOG_OBJECT (enc, "Received buffer of size %d with adapter of size : %d",
+ GST_BUFFER_SIZE (buf), size);
+
/* we need to process 640 input bytes to produce 40 output bytes */
/* calculate the amount of frames we will handle */
num_frames = size / 640;
@@ -260,7 +262,8 @@ gst_siren_enc_chain (GstPad * pad, GstBuffer * buf)
timestamp = gst_adapter_prev_timestamp (enc->adapter, &distance);
/* add the amount of time taken by the distance */
- timestamp += gst_util_uint64_scale_int (distance / 2, GST_SECOND, 16000);
+ if (timestamp != -1)
+ timestamp += gst_util_uint64_scale_int (distance / 2, GST_SECOND, 16000);
GST_LOG_OBJECT (enc,
"timestamp %" GST_TIME_FORMAT ", distance %" G_GUINT64_FORMAT,
@@ -299,8 +302,6 @@ done:
if (to_free)
g_free (to_free);
- gst_object_unref (enc);
-
return ret;
/* ERRORS */