gstrtpg722pay: Compensate for clockrate vs. samplerate difference
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 10 Oct 2011 18:01:23 +0000 (19:01 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 10 Oct 2011 20:50:28 +0000 (21:50 +0100)
The RTP clock-rate used for G722 is 8000, even though the samplerate is
16000. Compensate for this by pretending G722 has 8 bits per sample
instead of the 4 bits as if it were a codec that ran at half the speed,
but with twice the number of bits. Fixes #661376

gst/rtp/gstrtpg722pay.c

index 29cd22a..45ba4bb 100644 (file)
@@ -160,9 +160,11 @@ gst_rtp_g722_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
   rtpg722pay->rate = rate;
   rtpg722pay->channels = channels;
 
-  /* octet-per-sample is 1 * channels for G722 */
+  /* bits-per-sample is 4 * channels for G722, but as the RTP clock runs at
+   * half speed (8 instead of 16 khz), pretend it's 8 bits per sample
+   * channels. */
   gst_base_rtp_audio_payload_set_samplebits_options (basertpaudiopayload,
-      4 * rtpg722pay->channels);
+      8 * rtpg722pay->channels);
 
   return res;