summaryrefslogtreecommitdiff
path: root/toxav/codec.c
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2015-02-17 23:34:40 +0100
committermannol <eniz_vukovic@hotmail.com>2015-02-17 23:34:40 +0100
commit483a6ffa328e8699d156633ab3e0016171e11dd8 (patch)
tree78f7f6e555ad589a9242b93803023f30e2aa4ee3 /toxav/codec.c
parent7329f3b3d461a8f7738fa4b13a2dffc8d6a5b5f5 (diff)
Added 2 new headers into msi for buffer control
Diffstat (limited to 'toxav/codec.c')
-rw-r--r--toxav/codec.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/toxav/codec.c b/toxav/codec.c
index e6fe713e..9fc14071 100644
--- a/toxav/codec.c
+++ b/toxav/codec.c
@@ -1,8 +1,6 @@
1/** codec.c 1/** codec.c
2 * 2 *
3 * Audio and video codec intitialization, encoding/decoding and playback 3 * Copyright (C) 2013-2015 Tox project All Rights Reserved.
4 *
5 * Copyright (C) 2013 Tox project All Rights Reserved.
6 * 4 *
7 * This file is part of Tox. 5 * This file is part of Tox.
8 * 6 *
@@ -124,7 +122,7 @@ static void buffer_free(PayloadBuffer *b)
124} 122}
125 123
126/* JITTER BUFFER WORK */ 124/* JITTER BUFFER WORK */
127typedef struct JitterBuffer { 125typedef struct JitterBuffer_s {
128 RTPMessage **queue; 126 RTPMessage **queue;
129 uint32_t size; 127 uint32_t size;
130 uint32_t capacity; 128 uint32_t capacity;
@@ -711,11 +709,6 @@ int cs_enable_audio_sending(CSSession* cs, uint32_t bitrate, int channels)
711 if (cs->audio_encoder) 709 if (cs->audio_encoder)
712 return 0; 710 return 0;
713 711
714 /**
715 * Encoder is initialized with default values. These values (Sampling rate, channel count)
716 * change on the fly from toxav.
717 */
718
719 int rc = OPUS_OK; 712 int rc = OPUS_OK;
720 cs->audio_encoder = opus_encoder_create(48000, channels, OPUS_APPLICATION_AUDIO, &rc); 713 cs->audio_encoder = opus_encoder_create(48000, channels, OPUS_APPLICATION_AUDIO, &rc);
721 714
@@ -750,12 +743,7 @@ int cs_enable_audio_receiving(CSSession* cs)
750{ 743{
751 if (cs->audio_decoder) 744 if (cs->audio_decoder)
752 return 0; 745 return 0;
753 746
754 /**
755 * Decoder is initialized with default values. These values (Sampling rate, channel count)
756 * change on the fly from toxav.
757 */
758
759 int rc; 747 int rc;
760 cs->audio_decoder = opus_decoder_create(48000, 2, &rc ); 748 cs->audio_decoder = opus_decoder_create(48000, 2, &rc );
761 749
@@ -792,7 +780,7 @@ void queue_message(RTPSession *session, RTPMessage *msg)
792 if (!cs) return; 780 if (!cs) return;
793 781
794 /* Audio */ 782 /* Audio */
795 if (session->payload_type == msi_TypeAudio % 128) { 783 if (session->payload_type == rtp_TypeAudio % 128) {
796 pthread_mutex_lock(cs->queue_mutex); 784 pthread_mutex_lock(cs->queue_mutex);
797 int ret = jbuf_write(cs->j_buf, msg); 785 int ret = jbuf_write(cs->j_buf, msg);
798 pthread_mutex_unlock(cs->queue_mutex); 786 pthread_mutex_unlock(cs->queue_mutex);