summaryrefslogtreecommitdiff
path: root/toxav/codec.c
diff options
context:
space:
mode:
authorJason Locklin <jalockli@uwaterloo.ca>2015-07-31 11:08:51 -0400
committerJason Locklin <jalockli@uwaterloo.ca>2015-07-31 11:08:51 -0400
commitef086a5897ab2f3296ba777e7e1229384981313c (patch)
treefe733025e709c9de8c0fd4291bf71fa49bf3709b /toxav/codec.c
parentbcb864af4ac51fb78cdac9df249949d6fbca937a (diff)
Set packet loss percentage
Make the Codec resistant to up to 10% packet loss (default 0) at the expense of some bandwidth. 10% is aggressive (1-5% should be typical for voip systems, but can be higher when users are on WiFi connections. This could also be adjusted on the fly, rather than hard-coded, with feedback from the receiving client.
Diffstat (limited to 'toxav/codec.c')
-rw-r--r--toxav/codec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/toxav/codec.c b/toxav/codec.c
index 7b76929c..9f705db4 100644
--- a/toxav/codec.c
+++ b/toxav/codec.c
@@ -315,6 +315,14 @@ static int init_audio_encoder(CSSession *cs)
315 return -1; 315 return -1;
316 } 316 }
317 317
318 /* Make codec resistant to up to 10% packet loss */
319 rc = opus_encoder_ctl(cs->audio_encoder, OPUS_SET_PACKET_LOSS_PERC(10));
320
321 if ( rc != OPUS_OK ) {
322 LOGGER_ERROR("Error while setting encoder ctl: %s", opus_strerror(rc));
323 return -1;
324 }
325
318 rc = opus_encoder_ctl(cs->audio_encoder, OPUS_SET_COMPLEXITY(10)); 326 rc = opus_encoder_ctl(cs->audio_encoder, OPUS_SET_COMPLEXITY(10));
319 327
320 if ( rc != OPUS_OK ) { 328 if ( rc != OPUS_OK ) {