summaryrefslogtreecommitdiff
path: root/toxav
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-06-15 10:36:57 -0400
committerirungentoo <irungentoo@gmail.com>2014-06-15 10:36:57 -0400
commit750c75a47dda2712bc988fecd95510ccf54c68fd (patch)
tree001528115bcd2c312e4183bf93d8e08eeae0b7f1 /toxav
parenta38d962b040e06ebe986e59e4c53843dc5fbbfab (diff)
Astyled code.
Diffstat (limited to 'toxav')
-rw-r--r--toxav/event.c10
-rw-r--r--toxav/event.h4
-rw-r--r--toxav/msi.c88
-rw-r--r--toxav/toxav.c18
4 files changed, 65 insertions, 55 deletions
diff --git a/toxav/event.c b/toxav/event.c
index 35af98bb..870abf2a 100644
--- a/toxav/event.c
+++ b/toxav/event.c
@@ -68,9 +68,9 @@ typedef struct _EventHandler {
68 68
69} EventHandler; 69} EventHandler;
70 70
71int throw_event( void * (func)(void *), void *arg ); 71int throw_event( void *(func)(void *), void *arg );
72int reset_timer_event ( int id, uint32_t timeout ); 72int reset_timer_event ( int id, uint32_t timeout );
73int throw_timer_event ( void * (func)(void *), void *arg, unsigned timeout); 73int throw_timer_event ( void *(func)(void *), void *arg, unsigned timeout);
74int cancel_timer_event ( int id ); 74int cancel_timer_event ( int id );
75int execute_timer_event ( int id ); 75int execute_timer_event ( int id );
76 76
@@ -142,7 +142,7 @@ int pop_id ( EventContainer **event_container, size_t *counter, int id )
142 return -1; 142 return -1;
143} 143}
144 144
145void push_event ( EventContainer **container, size_t *counter, void * (func)(void *), void *arg ) 145void push_event ( EventContainer **container, size_t *counter, void *(func)(void *), void *arg )
146{ 146{
147 EventContainer *_new = realloc((*container ), sizeof(EventContainer) * ((*counter ) + 1)); 147 EventContainer *_new = realloc((*container ), sizeof(EventContainer) * ((*counter ) + 1));
148 148
@@ -230,7 +230,7 @@ void *event_poll( void *arg )
230 pthread_exit(NULL); 230 pthread_exit(NULL);
231} 231}
232 232
233int throw_event( void * (func)(void *), void *arg ) 233int throw_event( void *(func)(void *), void *arg )
234{ 234{
235 pthread_t _tid; 235 pthread_t _tid;
236 int _rc = 236 int _rc =
@@ -242,7 +242,7 @@ int throw_event( void * (func)(void *), void *arg )
242EventHandler event_handler; 242EventHandler event_handler;
243 243
244/* Place and order array of timers */ 244/* Place and order array of timers */
245int throw_timer_event ( void * (func)(void *), void *arg, unsigned timeout) 245int throw_timer_event ( void *(func)(void *), void *arg, unsigned timeout)
246{ 246{
247 static int _unique_id = 1; 247 static int _unique_id = 1;
248 248
diff --git a/toxav/event.h b/toxav/event.h
index 0fb2d120..f9e67543 100644
--- a/toxav/event.h
+++ b/toxav/event.h
@@ -39,9 +39,9 @@
39 * 39 *
40 */ 40 */
41extern struct _Event { 41extern struct _Event {
42 int (*rise) (void * ( func ) ( void * ), void *arg); 42 int (*rise) (void *( func ) ( void *), void *arg);
43 int (*timer_reset ) ( int id, unsigned timeout ); 43 int (*timer_reset ) ( int id, unsigned timeout );
44 int (*timer_alloc) (void * ( func ) ( void * ), void *arg, unsigned timeout); 44 int (*timer_alloc) (void *( func ) ( void *), void *arg, unsigned timeout);
45 int (*timer_release) (int id); 45 int (*timer_release) (int id);
46 int (*timer_now) ( int id ); 46 int (*timer_now) ( int id );
47} event; 47} event;
diff --git a/toxav/msi.c b/toxav/msi.c
index c7d729b9..6a529699 100644
--- a/toxav/msi.c
+++ b/toxav/msi.c
@@ -167,11 +167,11 @@ typedef enum {
167static inline__ const uint8_t *stringify_request ( MSIRequest request ) 167static inline__ const uint8_t *stringify_request ( MSIRequest request )
168{ 168{
169 static const uint8_t *strings[] = { 169 static const uint8_t *strings[] = {
170 ( uint8_t * ) "INVITE", 170 ( uint8_t *) "INVITE",
171 ( uint8_t * ) "START", 171 ( uint8_t *) "START",
172 ( uint8_t * ) "CANCEL", 172 ( uint8_t *) "CANCEL",
173 ( uint8_t * ) "REJECT", 173 ( uint8_t *) "REJECT",
174 ( uint8_t * ) "END" 174 ( uint8_t *) "END"
175 }; 175 };
176 176
177 return strings[request]; 177 return strings[request];
@@ -196,10 +196,10 @@ typedef enum {
196static inline__ const uint8_t *stringify_response ( MSIResponse response ) 196static inline__ const uint8_t *stringify_response ( MSIResponse response )
197{ 197{
198 static const uint8_t *strings[] = { 198 static const uint8_t *strings[] = {
199 ( uint8_t * ) "ringing", 199 ( uint8_t *) "ringing",
200 ( uint8_t * ) "starting", 200 ( uint8_t *) "starting",
201 ( uint8_t * ) "ending", 201 ( uint8_t *) "ending",
202 ( uint8_t * ) "error" 202 ( uint8_t *) "error"
203 }; 203 };
204 204
205 return strings[response]; 205 return strings[response];
@@ -243,7 +243,7 @@ iterator = iterator + 2 + _value_size; /* set iterator at new header or end_byte
243 243
244 const uint8_t *_it = data; 244 const uint8_t *_it = data;
245 uint16_t size_max = length; 245 uint16_t size_max = length;
246 246
247 while ( *_it ) {/* until end_byte is hit */ 247 while ( *_it ) {/* until end_byte is hit */
248 248
249 uint16_t itedlen = (_it - data) + 2; 249 uint16_t itedlen = (_it - data) + 2;
@@ -251,14 +251,14 @@ iterator = iterator + 2 + _value_size; /* set iterator at new header or end_byte
251 if ( *_it == field_byte && itedlen < length ) { 251 if ( *_it == field_byte && itedlen < length ) {
252 252
253 uint16_t _size; 253 uint16_t _size;
254 memcpy(&_size, _it + 1, sizeof(_size)); 254 memcpy(&_size, _it + 1, sizeof(_size));
255 _size = ntohs(_size); 255 _size = ntohs(_size);
256 256
257 if ( itedlen + _size > length ) return -1; 257 if ( itedlen + _size > length ) return -1;
258 258
259 _it += 3; /* place it at the field value beginning */ 259 _it += 3; /* place it at the field value beginning */
260 size_max -= 3; 260 size_max -= 3;
261 261
262 switch ( _size ) { /* Compare the size of the hardcoded values ( vary fast and convenient ) */ 262 switch ( _size ) { /* Compare the size of the hardcoded values ( vary fast and convenient ) */
263 263
264 case 4: { /* INFO header */ 264 case 4: { /* INFO header */
@@ -278,9 +278,9 @@ iterator = iterator + 2 + _value_size; /* set iterator at new header or end_byte
278 278
279 case 7: { /* Version, Request, Call-id headers */ 279 case 7: { /* Version, Request, Call-id headers */
280 if ON_HEADER ( _it, size_max, msg->version, VERSION_FIELD, 7 ) 280 if ON_HEADER ( _it, size_max, msg->version, VERSION_FIELD, 7 )
281 else if ON_HEADER ( _it, size_max, msg->request, REQUEST_FIELD, 7 ) 281 else if ON_HEADER ( _it, size_max, msg->request, REQUEST_FIELD, 7 )
282 else if ON_HEADER ( _it, size_max, msg->callid, CALLID_FIELD, 7 ) 282 else if ON_HEADER ( _it, size_max, msg->callid, CALLID_FIELD, 7 )
283 } 283 }
284 break; 284 break;
285 285
286 case 8: { /* Response header */ 286 case 8: { /* Response header */
@@ -513,9 +513,10 @@ uint8_t *append_header_to_string (
513 513
514 /* Now set the length of the field byte */ 514 /* Now set the length of the field byte */
515 uint16_t _convert; 515 uint16_t _convert;
516 516
517 517
518 _convert = htons(_i); 518 _convert = htons(_i);
519
519 memcpy(_getback_byte, &_convert, sizeof(_convert)); 520 memcpy(_getback_byte, &_convert, sizeof(_convert));
520 521
521 /* for value part do it regulary */ 522 /* for value part do it regulary */
@@ -523,11 +524,12 @@ uint8_t *append_header_to_string (
523 524
524 dest++; 525 dest++;
525 526
526 527
527 _convert = htons(value_len); 528 _convert = htons(value_len);
529
528 memcpy(dest, &_convert, sizeof(_convert)); 530 memcpy(dest, &_convert, sizeof(_convert));
529 531
530 dest+=2; 532 dest += 2;
531 533
532 for ( _i = value_len; _i; --_i ) { 534 for ( _i = value_len; _i; --_i ) {
533 *dest = *_hvit; 535 *dest = *_hvit;
@@ -645,13 +647,13 @@ typedef enum {
645static inline__ const uint8_t *stringify_error ( MSICallError error_code ) 647static inline__ const uint8_t *stringify_error ( MSICallError error_code )
646{ 648{
647 static const uint8_t *strings[] = { 649 static const uint8_t *strings[] = {
648 ( uint8_t * ) "", 650 ( uint8_t *) "",
649 ( uint8_t * ) "Using dead call", 651 ( uint8_t *) "Using dead call",
650 ( uint8_t * ) "Call id not set to any call", 652 ( uint8_t *) "Call id not set to any call",
651 ( uint8_t * ) "Call id not available", 653 ( uint8_t *) "Call id not available",
652 ( uint8_t * ) "No active call in session", 654 ( uint8_t *) "No active call in session",
653 ( uint8_t * ) "No Crypto-key set", 655 ( uint8_t *) "No Crypto-key set",
654 ( uint8_t * ) "Callee busy" 656 ( uint8_t *) "Callee busy"
655 }; 657 };
656 658
657 return strings[error_code]; 659 return strings[error_code];
@@ -667,13 +669,13 @@ static inline__ const uint8_t *stringify_error ( MSICallError error_code )
667static inline__ const uint8_t *stringify_error_code ( MSICallError error_code ) 669static inline__ const uint8_t *stringify_error_code ( MSICallError error_code )
668{ 670{
669 static const uint8_t *strings[] = { 671 static const uint8_t *strings[] = {
670 ( uint8_t * ) "", 672 ( uint8_t *) "",
671 ( uint8_t * ) "1", 673 ( uint8_t *) "1",
672 ( uint8_t * ) "2", 674 ( uint8_t *) "2",
673 ( uint8_t * ) "3", 675 ( uint8_t *) "3",
674 ( uint8_t * ) "4", 676 ( uint8_t *) "4",
675 ( uint8_t * ) "5", 677 ( uint8_t *) "5",
676 ( uint8_t * ) "6" 678 ( uint8_t *) "6"
677 }; 679 };
678 680
679 return strings[error_code]; 681 return strings[error_code];
@@ -756,10 +758,10 @@ void flush_peer_type ( MSICall *call, MSIMessage *msg, int peer_id )
756 memcpy(hdrval, msg->calltype.header_value, msg->calltype.size); 758 memcpy(hdrval, msg->calltype.header_value, msg->calltype.size);
757 hdrval[msg->calltype.size] = '\0'; 759 hdrval[msg->calltype.size] = '\0';
758 760
759 if ( strcmp ( ( const char * ) hdrval, CT_AUDIO_HEADER_VALUE ) == 0 ) { 761 if ( strcmp ( ( const char *) hdrval, CT_AUDIO_HEADER_VALUE ) == 0 ) {
760 call->type_peer[peer_id] = type_audio; 762 call->type_peer[peer_id] = type_audio;
761 763
762 } else if ( strcmp ( ( const char * ) hdrval, CT_VIDEO_HEADER_VALUE ) == 0 ) { 764 } else if ( strcmp ( ( const char *) hdrval, CT_VIDEO_HEADER_VALUE ) == 0 ) {
763 call->type_peer[peer_id] = type_video; 765 call->type_peer[peer_id] = type_video;
764 } else {} /* Error */ 766 } else {} /* Error */
765 } else {} /* Error */ 767 } else {} /* Error */
@@ -831,7 +833,7 @@ int handle_error ( MSISession *session, MSICall *call, MSICallError errid, uint3
831 833
832 const uint8_t *_error_code_str = stringify_error_code ( errid ); 834 const uint8_t *_error_code_str = stringify_error_code ( errid );
833 835
834 msi_msg_set_reason ( _msg_error, _error_code_str, strlen ( ( const char * ) _error_code_str ) ); 836 msi_msg_set_reason ( _msg_error, _error_code_str, strlen ( ( const char *) _error_code_str ) );
835 send_message ( session, call, _msg_error, to ); 837 send_message ( session, call, _msg_error, to );
836 free_message ( _msg_error ); 838 free_message ( _msg_error );
837 839
@@ -1325,7 +1327,7 @@ int handle_recv_error ( MSISession *session, MSICall *call, MSIMessage *msg )
1325 1327
1326 /* Handle error accordingly */ 1328 /* Handle error accordingly */
1327 if ( msg->reason.header_value ) { 1329 if ( msg->reason.header_value ) {
1328 session->last_error_id = atoi ( ( const char * ) msg->reason.header_value ); 1330 session->last_error_id = atoi ( ( const char *) msg->reason.header_value );
1329 session->last_error_str = stringify_error ( session->last_error_id ); 1331 session->last_error_str = stringify_error ( session->last_error_id );
1330 LOGGER_DEBUG("Error reason: %s", session->last_error_str); 1332 LOGGER_DEBUG("Error reason: %s", session->last_error_str);
1331 } 1333 }
@@ -1612,9 +1614,9 @@ int msi_invite ( MSISession *session, int32_t *call_index, MSICallType call_type
1612 1614
1613 /* Do whatever with message */ 1615 /* Do whatever with message */
1614 if ( call_type == type_audio ) { 1616 if ( call_type == type_audio ) {
1615 msi_msg_set_calltype ( _msg_invite, ( const uint8_t * ) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) ); 1617 msi_msg_set_calltype ( _msg_invite, ( const uint8_t *) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) );
1616 } else { 1618 } else {
1617 msi_msg_set_calltype ( _msg_invite, ( const uint8_t * ) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) ); 1619 msi_msg_set_calltype ( _msg_invite, ( const uint8_t *) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) );
1618 } 1620 }
1619 1621
1620 send_message ( session, _call, _msg_invite, friend_id ); 1622 send_message ( session, _call, _msg_invite, friend_id );
@@ -1702,10 +1704,10 @@ int msi_answer ( MSISession *session, int32_t call_index, MSICallType call_type
1702 1704
1703 if ( call_type == type_audio ) { 1705 if ( call_type == type_audio ) {
1704 msi_msg_set_calltype 1706 msi_msg_set_calltype
1705 ( _msg_starting, ( const uint8_t * ) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) ); 1707 ( _msg_starting, ( const uint8_t *) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) );
1706 } else { 1708 } else {
1707 msi_msg_set_calltype 1709 msi_msg_set_calltype
1708 ( _msg_starting, ( const uint8_t * ) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) ); 1710 ( _msg_starting, ( const uint8_t *) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) );
1709 } 1711 }
1710 1712
1711 /* Now set the local encryption key and pass it with STARTING message */ 1713 /* Now set the local encryption key and pass it with STARTING message */
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 959ef54c..a042b9dd 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -351,7 +351,7 @@ int toxav_prepare_transmission ( ToxAv *av, int32_t call_index, ToxAvCodecSettin
351int toxav_kill_transmission ( ToxAv *av, int32_t call_index ) 351int toxav_kill_transmission ( ToxAv *av, int32_t call_index )
352{ 352{
353 if (cii(call_index, av->msi_session)) return ErrorNoCall; 353 if (cii(call_index, av->msi_session)) return ErrorNoCall;
354 354
355 CallSpecific *call = &av->calls[call_index]; 355 CallSpecific *call = &av->calls[call_index];
356 356
357 if ( call->crtps[audio_index] && -1 == rtp_terminate_session(call->crtps[audio_index], av->messenger) ) { 357 if ( call->crtps[audio_index] && -1 == rtp_terminate_session(call->crtps[audio_index], av->messenger) ) {
@@ -398,7 +398,7 @@ inline__ int toxav_send_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
398 uint16_t length ) 398 uint16_t length )
399{ 399{
400 if (cii(call_index, av->msi_session)) return ErrorNoCall; 400 if (cii(call_index, av->msi_session)) return ErrorNoCall;
401 401
402 if ( av->calls[call_index].crtps[type - TypeAudio] ) 402 if ( av->calls[call_index].crtps[type - TypeAudio] )
403 return rtp_send_msg ( av->calls[call_index].crtps[type - TypeAudio], av->msi_session->messenger_handle, payload, 403 return rtp_send_msg ( av->calls[call_index].crtps[type - TypeAudio], av->msi_session->messenger_handle, payload,
404 length ); 404 length );
@@ -418,6 +418,7 @@ inline__ int toxav_send_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
418inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallType type, uint8_t *dest ) 418inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallType type, uint8_t *dest )
419{ 419{
420 if ( !dest ) return ErrorInternal; 420 if ( !dest ) return ErrorInternal;
421
421 if (cii(call_index, av->msi_session)) return ErrorNoCall; 422 if (cii(call_index, av->msi_session)) return ErrorNoCall;
422 423
423 CallSpecific *call = &av->calls[call_index]; 424 CallSpecific *call = &av->calls[call_index];
@@ -470,6 +471,7 @@ inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
470inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **output) 471inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **output)
471{ 472{
472 if ( !output ) return ErrorInternal; 473 if ( !output ) return ErrorInternal;
474
473 if (cii(call_index, av->msi_session)) return ErrorNoCall; 475 if (cii(call_index, av->msi_session)) return ErrorNoCall;
474 476
475 uint8_t packet [RTP_PAYLOAD_SIZE]; 477 uint8_t packet [RTP_PAYLOAD_SIZE];
@@ -507,6 +509,7 @@ inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **out
507inline__ int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size) 509inline__ int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size)
508{ 510{
509 if (cii(call_index, av->msi_session)) return ErrorNoCall; 511 if (cii(call_index, av->msi_session)) return ErrorNoCall;
512
510 return toxav_send_rtp_payload(av, call_index, TypeVideo, frame, frame_size); 513 return toxav_send_rtp_payload(av, call_index, TypeVideo, frame, frame_size);
511} 514}
512 515
@@ -524,7 +527,7 @@ inline__ int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *fr
524inline__ int toxav_prepare_video_frame(ToxAv *av, int32_t call_index, uint8_t *dest, int dest_max, vpx_image_t *input) 527inline__ int toxav_prepare_video_frame(ToxAv *av, int32_t call_index, uint8_t *dest, int dest_max, vpx_image_t *input)
525{ 528{
526 if (cii(call_index, av->msi_session)) return ErrorNoCall; 529 if (cii(call_index, av->msi_session)) return ErrorNoCall;
527 530
528 CallSpecific *call = &av->calls[call_index]; 531 CallSpecific *call = &av->calls[call_index];
529 532
530 int rc = vpx_codec_encode(&call->cs->v_encoder, input, call->cs->frame_counter, 1, 0, MAX_ENCODE_TIME_US); 533 int rc = vpx_codec_encode(&call->cs->v_encoder, input, call->cs->frame_counter, 1, 0, MAX_ENCODE_TIME_US);
@@ -567,6 +570,7 @@ inline__ int toxav_prepare_video_frame(ToxAv *av, int32_t call_index, uint8_t *d
567inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, int16_t *dest ) 570inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, int16_t *dest )
568{ 571{
569 if ( !dest ) return ErrorInternal; 572 if ( !dest ) return ErrorInternal;
573
570 if (cii(call_index, av->msi_session)) return ErrorNoCall; 574 if (cii(call_index, av->msi_session)) return ErrorNoCall;
571 575
572 CallSpecific *call = &av->calls[call_index]; 576 CallSpecific *call = &av->calls[call_index];
@@ -609,6 +613,7 @@ inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, i
609inline__ int toxav_send_audio ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size) 613inline__ int toxav_send_audio ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size)
610{ 614{
611 if (cii(call_index, av->msi_session)) return ErrorNoCall; 615 if (cii(call_index, av->msi_session)) return ErrorNoCall;
616
612 return toxav_send_rtp_payload(av, call_index, TypeAudio, frame, frame_size); 617 return toxav_send_rtp_payload(av, call_index, TypeAudio, frame, frame_size);
613} 618}
614 619
@@ -628,6 +633,7 @@ inline__ int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t
628 const int16_t *frame, int frame_size) 633 const int16_t *frame, int frame_size)
629{ 634{
630 if (cii(call_index, av->msi_session)) return ErrorNoCall; 635 if (cii(call_index, av->msi_session)) return ErrorNoCall;
636
631 int32_t rc = opus_encode(av->calls[call_index].cs->audio_encoder, frame, frame_size, dest, dest_max); 637 int32_t rc = opus_encode(av->calls[call_index].cs->audio_encoder, frame, frame_size, dest, dest_max);
632 638
633 if (rc < 0) { 639 if (rc < 0) {
@@ -649,7 +655,8 @@ inline__ int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t
649 */ 655 */
650int toxav_get_peer_transmission_type ( ToxAv *av, int32_t call_index, int peer ) 656int toxav_get_peer_transmission_type ( ToxAv *av, int32_t call_index, int peer )
651{ 657{
652 if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index] || av->msi_session->calls[call_index]->peer_count <= peer ) 658 if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index]
659 || av->msi_session->calls[call_index]->peer_count <= peer )
653 return ErrorInternal; 660 return ErrorInternal;
654 661
655 return av->msi_session->calls[call_index]->type_peer[peer]; 662 return av->msi_session->calls[call_index]->type_peer[peer];
@@ -667,7 +674,8 @@ int toxav_get_peer_id ( ToxAv *av, int32_t call_index, int peer )
667{ 674{
668 assert(av->msi_session); 675 assert(av->msi_session);
669 676
670 if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index] || av->msi_session->calls[call_index]->peer_count <= peer ) 677 if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index]
678 || av->msi_session->calls[call_index]->peer_count <= peer )
671 return ErrorInternal; 679 return ErrorInternal;
672 680
673 return av->msi_session->calls[call_index]->peers[peer]; 681 return av->msi_session->calls[call_index]->peers[peer];