summaryrefslogtreecommitdiff
path: root/toxav
diff options
context:
space:
mode:
Diffstat (limited to 'toxav')
-rw-r--r--toxav/toxav.c26
-rw-r--r--toxav/toxav.h4
2 files changed, 16 insertions, 14 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 38114ad1..a301e007 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -77,8 +77,8 @@ struct _ToxAv {
77 MSISession *msi_session; /** Main msi session */ 77 MSISession *msi_session; /** Main msi session */
78 CallSpecific *calls; /** Per-call params */ 78 CallSpecific *calls; /** Per-call params */
79 79
80 void (*audio_callback)(ToxAv*, int32_t, int16_t*, int); 80 void (*audio_callback)(ToxAv *, int32_t, int16_t *, int);
81 void (*video_callback)(ToxAv*, int32_t, vpx_image_t*); 81 void (*video_callback)(ToxAv *, int32_t, vpx_image_t *);
82 82
83 uint32_t max_calls; 83 uint32_t max_calls;
84}; 84};
@@ -178,7 +178,7 @@ void toxav_register_callstate_callback ( ToxAVCallback callback, ToxAvCallbackID
178 * @param callback The callback 178 * @param callback The callback
179 * @return void 179 * @return void
180 */ 180 */
181void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv*, int32_t, int16_t*, int)) 181void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, int32_t, int16_t *, int))
182{ 182{
183 av->audio_callback = callback; 183 av->audio_callback = callback;
184} 184}
@@ -189,9 +189,9 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv*, int
189 * @param callback The callback 189 * @param callback The callback
190 * @return void 190 * @return void
191 */ 191 */
192void toxav_register_video_recv_callback (ToxAv *av, void (*callback)(ToxAv*, int32_t, vpx_image_t*)) 192void toxav_register_video_recv_callback (ToxAv *av, void (*callback)(ToxAv *, int32_t, vpx_image_t *))
193{ 193{
194 av->video_callback = callback; 194 av->video_callback = callback;
195} 195}
196 196
197/** 197/**
@@ -758,22 +758,22 @@ void toxav_handle_packet(RTPSession *_session, RTPMessage *_msg)
758 int32_t call_index = _session->call_index; 758 int32_t call_index = _session->call_index;
759 CallSpecific *call = &av->calls[call_index]; 759 CallSpecific *call = &av->calls[call_index];
760 760
761 if(_session->payload_type == type_audio % 128) { 761 if (_session->payload_type == type_audio % 128) {
762 queue(call->j_buf, _msg); 762 queue(call->j_buf, _msg);
763 763
764 int success = 0, dec_size; 764 int success = 0, dec_size;
765 int frame_size = 960; 765 int frame_size = 960;
766 int16_t dest[frame_size]; 766 int16_t dest[frame_size];
767 767
768 while((_msg = dequeue(call->j_buf, &success)) || success == 2) { 768 while ((_msg = dequeue(call->j_buf, &success)) || success == 2) {
769 if(success == 2) { 769 if (success == 2) {
770 dec_size = opus_decode(call->cs->audio_decoder, NULL, 0, dest, frame_size, 1); 770 dec_size = opus_decode(call->cs->audio_decoder, NULL, 0, dest, frame_size, 1);
771 } else { 771 } else {
772 dec_size = opus_decode(call->cs->audio_decoder, _msg->data, _msg->length, dest, frame_size, 0); 772 dec_size = opus_decode(call->cs->audio_decoder, _msg->data, _msg->length, dest, frame_size, 0);
773 rtp_free_msg(NULL, _msg); 773 rtp_free_msg(NULL, _msg);
774 } 774 }
775 775
776 if(dec_size < 0) { 776 if (dec_size < 0) {
777 LOGGER_WARNING("Decoding error: %s", opus_strerror(dec_size)); 777 LOGGER_WARNING("Decoding error: %s", opus_strerror(dec_size));
778 continue; 778 continue;
779 } 779 }
@@ -784,7 +784,7 @@ void toxav_handle_packet(RTPSession *_session, RTPMessage *_msg)
784 uint8_t *packet = _msg->data; 784 uint8_t *packet = _msg->data;
785 int recved_size = _msg->length; 785 int recved_size = _msg->length;
786 786
787 if(recved_size < VIDEOFRAME_HEADER_SIZE) { 787 if (recved_size < VIDEOFRAME_HEADER_SIZE) {
788 goto end; 788 goto end;
789 } 789 }
790 790
@@ -824,11 +824,13 @@ void toxav_handle_packet(RTPSession *_session, RTPMessage *_msg)
824 LOGGER_DEBUG("Limit: %u\n", call->frame_limit); 824 LOGGER_DEBUG("Limit: %u\n", call->frame_limit);
825 } 825 }
826 826
827 end:; 827end:
828 ;
828 vpx_codec_iter_t iter = NULL; 829 vpx_codec_iter_t iter = NULL;
829 vpx_image_t *img; 830 vpx_image_t *img;
830 img = vpx_codec_get_frame(&call->cs->v_decoder, &iter); 831 img = vpx_codec_get_frame(&call->cs->v_decoder, &iter);
831 if(img) { 832
833 if (img) {
832 av->video_callback(av, call_index, img); 834 av->video_callback(av, call_index, img);
833 } 835 }
834 836
diff --git a/toxav/toxav.h b/toxav/toxav.h
index 6a35fccf..0ded42bd 100644
--- a/toxav/toxav.h
+++ b/toxav/toxav.h
@@ -170,7 +170,7 @@ void toxav_register_callstate_callback (ToxAVCallback callback, ToxAvCallbackID
170 * @param callback The callback 170 * @param callback The callback
171 * @return void 171 * @return void
172 */ 172 */
173void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv*, int32_t, int16_t*, int)); 173void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, int32_t, int16_t *, int));
174 174
175/** 175/**
176 * @brief Register callback for recieving video data 176 * @brief Register callback for recieving video data
@@ -178,7 +178,7 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv*, int
178 * @param callback The callback 178 * @param callback The callback
179 * @return void 179 * @return void
180 */ 180 */
181void toxav_register_video_recv_callback (ToxAv *av, void (*callback)(ToxAv*, int32_t, vpx_image_t*)); 181void toxav_register_video_recv_callback (ToxAv *av, void (*callback)(ToxAv *, int32_t, vpx_image_t *));
182 182
183/** 183/**
184 * @brief Call user. Use its friend_id. 184 * @brief Call user. Use its friend_id.