Remove unused variables in _class_init
[platform/upstream/gstreamer.git] / gst / rtp / gstrtpL16pay.c
index 2b5f250..927b3db 100644 (file)
@@ -1,5 +1,5 @@
 /* GStreamer
- * Copyright (C) <2007> Wim Taymans <wim@fluendo.com>
+ * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -35,10 +35,10 @@ GST_DEBUG_CATEGORY_STATIC (rtpL16pay_debug);
 
 /* elementfactory information */
 static const GstElementDetails gst_rtp_L16_pay_details =
-GST_ELEMENT_DETAILS ("RTP packet payloader",
+GST_ELEMENT_DETAILS ("RTP audio payloader",
     "Codec/Payloader/Network",
     "Payload-encode Raw audio into RTP packets (RFC 3551)",
-    "Wim Taymans <wim@fluendo.com>");
+    "Wim Taymans <wim.taymans@gmail.com>");
 
 static GstStaticPadTemplate gst_rtp_L16_pay_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
@@ -130,11 +130,9 @@ static void
 gst_rtp_L16_pay_class_init (GstRtpL16PayClass * klass)
 {
   GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
   GstBaseRTPPayloadClass *gstbasertppayload_class;
 
   gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
   gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
 
   parent_class = g_type_class_peek_parent (klass);
@@ -245,6 +243,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 +257,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 +349,6 @@ gst_rtp_L16_pay_getcaps (GstBaseRTPPayload * rtppayload, GstPad * pad)
     }
     gst_caps_unref (otherpadcaps);
   }
-
   return caps;
 }