summaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/audio.c b/src/audio.c
index 46d7f03..d8bb689 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -302,6 +302,7 @@ static int add_audio_codec(struct audio *a, struct sdp_media *m,
static void encode_rtp_send(struct audio *a, struct autx *tx,
int16_t *sampv, size_t sampc)
{
+ unsigned frame_size; /* number of samples per channel */
size_t len;
int err;
@@ -328,7 +329,12 @@ static void encode_rtp_send(struct audio *a, struct autx *tx,
goto out;
}
- tx->ts += (uint32_t)(tx->is_g722 ? sampc/2 : sampc);
+ /* The RTP clock rate used for generating the RTP timestamp is
+ * independent of the number of channels and the encoding
+ */
+ frame_size = (tx->is_g722 ? sampc/2 : sampc) / tx->ac->ch;
+
+ tx->ts += frame_size;
out:
tx->marker = false;
@@ -700,7 +706,7 @@ int audio_alloc(struct audio **ap, const struct config *cfg,
auresamp_init(&tx->resamp);
str_ncpy(tx->device, a->cfg.src_dev, sizeof(tx->device));
tx->ptime = ptime;
- tx->ts = 160;
+ tx->ts = rand_u16();
tx->marker = true;
auresamp_init(&rx->resamp);