diff options
-rw-r--r-- | build/Makefile.am | 3 | ||||
-rw-r--r-- | toxav/Makefile.inc | 137 | ||||
-rwxr-xr-x | toxav/phone.c | 2 | ||||
-rw-r--r-- | toxav/toxmedia.c | 76 | ||||
-rw-r--r-- | toxav/toxmedia.h | 17 | ||||
-rwxr-xr-x | toxav/toxrtp.c | 2 | ||||
-rwxr-xr-x | toxav/toxrtp.h | 2 | ||||
-rw-r--r-- | toxcore/Makefile.inc | 10 |
8 files changed, 188 insertions, 61 deletions
diff --git a/build/Makefile.am b/build/Makefile.am index 9530e1a7..5514a4d5 100644 --- a/build/Makefile.am +++ b/build/Makefile.am | |||
@@ -5,8 +5,7 @@ noinst_bindir = $(top_builddir)/build | |||
5 | EXTRA_DIST= | 5 | EXTRA_DIST= |
6 | 6 | ||
7 | include ../toxcore/Makefile.inc | 7 | include ../toxcore/Makefile.inc |
8 | include ../toxrtp/Makefile.inc | 8 | include ../toxav/Makefile.inc |
9 | include ../toxmsi/Makefile.inc | ||
10 | include ../other/Makefile.inc | 9 | include ../other/Makefile.inc |
11 | include ../testing/Makefile.inc | 10 | include ../testing/Makefile.inc |
12 | include ../other/bootstrap_serverdaemon/Makefile.inc | 11 | include ../other/bootstrap_serverdaemon/Makefile.inc |
diff --git a/toxav/Makefile.inc b/toxav/Makefile.inc new file mode 100644 index 00000000..203d8a07 --- /dev/null +++ b/toxav/Makefile.inc | |||
@@ -0,0 +1,137 @@ | |||
1 | if BUILD_AV | ||
2 | |||
3 | lib_LTLIBRARIES += libtoxrtp.la \ | ||
4 | libtoxmsi.la \ | ||
5 | libtoxmedia.la | ||
6 | |||
7 | |||
8 | # ****** RTP ****** # | ||
9 | |||
10 | libtoxrtp_la_include_HEADERS = \ | ||
11 | ../toxav/toxrtp.h | ||
12 | |||
13 | libtoxrtp_la_includedir = $(includedir)/tox | ||
14 | |||
15 | libtoxrtp_la_SOURCES = ../toxav/toxrtp.h \ | ||
16 | ../toxav/toxrtp.c | ||
17 | |||
18 | libtoxrtp_la_CFLAGS = -I../toxcore \ | ||
19 | -I../toxav \ | ||
20 | $(NACL_CFLAGS) | ||
21 | |||
22 | libtoxrtp_la_LDFLAGS = $(TOXRTP_LT_LDFLAGS) \ | ||
23 | $(NACL_LDFLAGS) \ | ||
24 | $(EXTRA_LT_LDFLAGS) | ||
25 | |||
26 | libtoxrtp_la_LIBS = libtoxcore.la \ | ||
27 | $(NACL_LIBS) | ||
28 | |||
29 | |||
30 | |||
31 | |||
32 | |||
33 | # ****** MSI ****** # | ||
34 | |||
35 | libtoxmsi_la_include_HEADERS = \ | ||
36 | ../toxav/toxmsi.h | ||
37 | |||
38 | libtoxmsi_la_includedir = $(includedir)/tox | ||
39 | |||
40 | libtoxmsi_la_SOURCES = ../toxav/toxmsi.h \ | ||
41 | ../toxav/toxmsi.c | ||
42 | |||
43 | libtoxmsi_la_CFLAGS = -I../toxcore \ | ||
44 | -I../toxav \ | ||
45 | $(NACL_CFLAGS) | ||
46 | |||
47 | libtoxmsi_la_LDFLAGS = $(TOXMSI_LT_LDFLAGS) \ | ||
48 | $(EXTRA_LT_LDFLAGS) \ | ||
49 | $(NACL_LDFLAGS) | ||
50 | |||
51 | libtoxmsi_la_LIBS = libtoxcore.la \ | ||
52 | $(NACL_LIBS) | ||
53 | |||
54 | |||
55 | |||
56 | |||
57 | |||
58 | # ****** MEDIA ****** # | ||
59 | |||
60 | libtoxmedia_la_include_HEADERS = \ | ||
61 | ../toxav/toxmedia.h | ||
62 | |||
63 | libtoxmedia_la_includedir = $(includedir)/tox | ||
64 | |||
65 | libtoxmedia_la_SOURCES = ../toxav/toxmedia.h \ | ||
66 | ../toxav/toxmedia.c | ||
67 | |||
68 | libtoxmedia_la_CFLAGS = -I../toxcore \ | ||
69 | -I../toxav \ | ||
70 | $(AVFORMAT_CFLAGS) \ | ||
71 | $(AVCODEC_CFLAGS) \ | ||
72 | $(AVUTIL_CFLAGS) \ | ||
73 | $(AVDEVICE_CFLAGS) \ | ||
74 | $(SWSCALE_CFLAGS) \ | ||
75 | $(SDL_CFLAGS) \ | ||
76 | $(OPENAL_CFLAGS) \ | ||
77 | $(NACL_CFLAGS) \ | ||
78 | $(OPUS_CFLAGS) | ||
79 | |||
80 | |||
81 | libtoxmedia_la_LDFLAGS = $(TOXMSI_LT_LDFLAGS) \ | ||
82 | $(TOXRTP_LT_LDFLAGS) \ | ||
83 | $(EXTRA_LT_LDFLAGS) \ | ||
84 | $(NACL_LDFLAGS) | ||
85 | |||
86 | |||
87 | libtoxmedia_la_LIBS = libtoxcore.la \ | ||
88 | $(NACL_LDFLAGS) \ | ||
89 | $(AVFORMAT_LIBS) \ | ||
90 | $(AVCODEC_LIBS) \ | ||
91 | $(AVUTIL_LIBS) \ | ||
92 | $(AVDEVICE_LIBS) \ | ||
93 | $(SWSCALE_LIBS) \ | ||
94 | $(SDL_LIBS) \ | ||
95 | $(OPENAL_LIBS) \ | ||
96 | $(NACL_LIBS) \ | ||
97 | $(OPUS_LIBS) | ||
98 | |||
99 | |||
100 | |||
101 | |||
102 | # ***** PHONE ***** # | ||
103 | |||
104 | noinst_PROGRAMS += phone | ||
105 | |||
106 | phone_SOURCES = ../toxav/phone.c | ||
107 | |||
108 | phone_CFLAGS = -I../toxcore \ | ||
109 | -I../toxav \ | ||
110 | $(AVFORMAT_CFLAGS) \ | ||
111 | $(AVCODEC_CFLAGS) \ | ||
112 | $(AVUTIL_CFLAGS) \ | ||
113 | $(AVDEVICE_CFLAGS) \ | ||
114 | $(SWSCALE_CFLAGS) \ | ||
115 | $(SDL_CFLAGS) \ | ||
116 | $(OPENAL_CFLAGS) \ | ||
117 | $(NACL_CFLAGS) \ | ||
118 | $(OPUS_CFLAGS) | ||
119 | |||
120 | |||
121 | phone_LDADD = libtoxrtp.la \ | ||
122 | libtoxmsi.la \ | ||
123 | libtoxmedia.la \ | ||
124 | libtoxcore.la \ | ||
125 | $(NACL_LDFLAGS) \ | ||
126 | $(AVFORMAT_LIBS) \ | ||
127 | $(AVCODEC_LIBS) \ | ||
128 | $(AVUTIL_LIBS) \ | ||
129 | $(AVDEVICE_LIBS) \ | ||
130 | $(SWSCALE_LIBS) \ | ||
131 | $(SDL_LIBS) \ | ||
132 | $(OPENAL_LIBS) \ | ||
133 | $(NACL_LIBS) \ | ||
134 | $(OPUS_LIBS) | ||
135 | |||
136 | |||
137 | endif \ No newline at end of file | ||
diff --git a/toxav/phone.c b/toxav/phone.c index b55a072c..6d4b5e6b 100755 --- a/toxav/phone.c +++ b/toxav/phone.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #endif /* HAVE_CONFIG_H */ | 35 | #endif /* HAVE_CONFIG_H */ |
36 | 36 | ||
37 | #define _BSD_SOURCE | 37 | #define _BSD_SOURCE |
38 | #define _GNU_SOURCE | ||
39 | 38 | ||
40 | #include <stdio.h> | 39 | #include <stdio.h> |
41 | #include <string.h> | 40 | #include <string.h> |
@@ -671,7 +670,6 @@ int print_help ( const char* _name ) | |||
671 | "\t[IP] (DHT ip)\n" | 670 | "\t[IP] (DHT ip)\n" |
672 | "\t[PORT] (DHT port)\n" | 671 | "\t[PORT] (DHT port)\n" |
673 | "\t[KEY] (DHT public key)\n" | 672 | "\t[KEY] (DHT public key)\n" |
674 | "P.S. Friends and key are stored in ./tox_phone.conf\n" | ||
675 | ,_name ); | 673 | ,_name ); |
676 | return 1; | 674 | return 1; |
677 | } | 675 | } |
diff --git a/toxav/toxmedia.c b/toxav/toxmedia.c index 4c9f5261..aff3cf8c 100644 --- a/toxav/toxmedia.c +++ b/toxav/toxmedia.c | |||
@@ -42,10 +42,7 @@ | |||
42 | #include <opus/opus.h> | 42 | #include <opus/opus.h> |
43 | 43 | ||
44 | #include "toxmsi.h" | 44 | #include "toxmsi.h" |
45 | #include "toxmsi_message.h" | 45 | #include "toxrtp.h" |
46 | #include "../toxrtp/toxrtp_message.h" | ||
47 | #include "../toxrtp/tests/test_helper.h" | ||
48 | #include "phone.h" | ||
49 | #include "toxmedia.h" | 46 | #include "toxmedia.h" |
50 | 47 | ||
51 | SDL_Surface *screen; | 48 | SDL_Surface *screen; |
@@ -77,7 +74,7 @@ int display_received_frame(codec_state *cs, AVFrame *r_video_frame) | |||
77 | } | 74 | } |
78 | 75 | ||
79 | struct jitter_buffer { | 76 | struct jitter_buffer { |
80 | rtp_msg_t **queue; | 77 | RTPMessage **queue; |
81 | uint16_t capacity; | 78 | uint16_t capacity; |
82 | uint16_t size; | 79 | uint16_t size; |
83 | uint16_t front; | 80 | uint16_t front; |
@@ -92,7 +89,7 @@ struct jitter_buffer *create_queue(int capacity) | |||
92 | { | 89 | { |
93 | struct jitter_buffer *q; | 90 | struct jitter_buffer *q; |
94 | q = (struct jitter_buffer *)calloc(sizeof(struct jitter_buffer),1); | 91 | q = (struct jitter_buffer *)calloc(sizeof(struct jitter_buffer),1); |
95 | q->queue = (rtp_msg_t **)calloc((sizeof(rtp_msg_t) * capacity),1); | 92 | q->queue = (RTPMessage **)calloc((sizeof(RTPMessage) * capacity),1); |
96 | int i = 0; | 93 | int i = 0; |
97 | 94 | ||
98 | for (i = 0; i < capacity; ++i) { | 95 | for (i = 0; i < capacity; ++i) { |
@@ -114,11 +111,15 @@ struct jitter_buffer *create_queue(int capacity) | |||
114 | uint8_t sequence_number_older(uint16_t sn_a, uint16_t sn_b, uint32_t ts_a, uint32_t ts_b) | 111 | uint8_t sequence_number_older(uint16_t sn_a, uint16_t sn_b, uint32_t ts_a, uint32_t ts_b) |
115 | { | 112 | { |
116 | /* should be stable enough */ | 113 | /* should be stable enough */ |
114 | |||
115 | /* TODO: There is already this kind of function in toxrtp.c. | ||
116 | * Maybe merge? | ||
117 | */ | ||
117 | return (sn_a > sn_b || ts_a > ts_b); | 118 | return (sn_a > sn_b || ts_a > ts_b); |
118 | } | 119 | } |
119 | 120 | ||
120 | /* success is 0 when there is nothing to dequeue, 1 when there's a good packet, 2 when there's a lost packet */ | 121 | /* success is 0 when there is nothing to dequeue, 1 when there's a good packet, 2 when there's a lost packet */ |
121 | rtp_msg_t *dequeue(struct jitter_buffer *q, int *success) | 122 | RTPMessage *dequeue(struct jitter_buffer *q, int *success) |
122 | { | 123 | { |
123 | if (q->size == 0 || q->queue_ready == 0) { | 124 | if (q->size == 0 || q->queue_ready == 0) { |
124 | q->queue_ready = 0; | 125 | q->queue_ready = 0; |
@@ -129,21 +130,21 @@ rtp_msg_t *dequeue(struct jitter_buffer *q, int *success) | |||
129 | int front = q->front; | 130 | int front = q->front; |
130 | 131 | ||
131 | if (q->id_set == 0) { | 132 | if (q->id_set == 0) { |
132 | q->current_id = q->queue[front]->_header->_sequence_number; | 133 | q->current_id = q->queue[front]->header->sequnum; |
133 | q->current_ts = q->queue[front]->_header->_timestamp; | 134 | q->current_ts = q->queue[front]->header->timestamp; |
134 | q->id_set = 1; | 135 | q->id_set = 1; |
135 | } else { | 136 | } else { |
136 | int next_id = q->queue[front]->_header->_sequence_number; | 137 | int next_id = q->queue[front]->header->sequnum; |
137 | int next_ts = q->queue[front]->_header->_timestamp; | 138 | int next_ts = q->queue[front]->header->timestamp; |
138 | 139 | ||
139 | /* if this packet is indeed the expected packet */ | 140 | /* if this packet is indeed the expected packet */ |
140 | if (next_id == (q->current_id + 1) % _MAX_SEQU_NUM) { | 141 | if (next_id == (q->current_id + 1) % MAX_SEQU_NUM) { |
141 | q->current_id = next_id; | 142 | q->current_id = next_id; |
142 | q->current_ts = next_ts; | 143 | q->current_ts = next_ts; |
143 | } else { | 144 | } else { |
144 | if (sequence_number_older(next_id, q->current_id, next_ts, q->current_ts)) { | 145 | if (sequence_number_older(next_id, q->current_id, next_ts, q->current_ts)) { |
145 | printf("nextid: %d current: %d\n", next_id, q->current_id); | 146 | printf("nextid: %d current: %d\n", next_id, q->current_id); |
146 | q->current_id = (q->current_id + 1) % _MAX_SEQU_NUM; | 147 | q->current_id = (q->current_id + 1) % MAX_SEQU_NUM; |
147 | *success = 2; /* tell the decoder the packet is lost */ | 148 | *success = 2; /* tell the decoder the packet is lost */ |
148 | return NULL; | 149 | return NULL; |
149 | } else { | 150 | } else { |
@@ -162,8 +163,8 @@ rtp_msg_t *dequeue(struct jitter_buffer *q, int *success) | |||
162 | q->front = 0; | 163 | q->front = 0; |
163 | 164 | ||
164 | *success = 1; | 165 | *success = 1; |
165 | q->current_id = q->queue[front]->_header->_sequence_number; | 166 | q->current_id = q->queue[front]->header->sequnum; |
166 | q->current_ts = q->queue[front]->_header->_timestamp; | 167 | q->current_ts = q->queue[front]->header->timestamp; |
167 | return q->queue[front]; | 168 | return q->queue[front]; |
168 | } | 169 | } |
169 | 170 | ||
@@ -184,7 +185,7 @@ int empty_queue(struct jitter_buffer *q) | |||
184 | return 0; | 185 | return 0; |
185 | } | 186 | } |
186 | 187 | ||
187 | int queue(struct jitter_buffer *q, rtp_msg_t *pk) | 188 | int queue(struct jitter_buffer *q, RTPMessage *pk) |
188 | { | 189 | { |
189 | if (q->size == q->capacity) { | 190 | if (q->size == q->capacity) { |
190 | printf("buffer full, emptying buffer...\n"); | 191 | printf("buffer full, emptying buffer...\n"); |
@@ -214,9 +215,9 @@ int queue(struct jitter_buffer *q, rtp_msg_t *pk) | |||
214 | if (b < 0) | 215 | if (b < 0) |
215 | b += q->capacity; | 216 | b += q->capacity; |
216 | 217 | ||
217 | if (sequence_number_older(q->queue[b]->_header->_sequence_number, q->queue[a]->_header->_sequence_number, | 218 | if (sequence_number_older(q->queue[b]->header->sequnum, q->queue[a]->header->sequnum, |
218 | q->queue[b]->_header->_timestamp, q->queue[a]->_header->_timestamp)) { | 219 | q->queue[b]->header->timestamp, q->queue[a]->header->timestamp)) { |
219 | rtp_msg_t *temp; | 220 | RTPMessage *temp; |
220 | temp = q->queue[a]; | 221 | temp = q->queue[a]; |
221 | q->queue[a] = q->queue[b]; | 222 | q->queue[a] = q->queue[b]; |
222 | q->queue[b] = temp; | 223 | q->queue[b] = temp; |
@@ -487,7 +488,7 @@ void *encode_video_thread(void *arg) | |||
487 | int p = 0; | 488 | int p = 0; |
488 | int err; | 489 | int err; |
489 | int got_packet; | 490 | int got_packet; |
490 | rtp_msg_t *s_video_msg; | 491 | RTPMessage *s_video_msg; |
491 | int video_frame_finished; | 492 | int video_frame_finished; |
492 | AVFrame *s_video_frame; | 493 | AVFrame *s_video_frame; |
493 | AVFrame *webcam_frame; | 494 | AVFrame *webcam_frame; |
@@ -552,18 +553,13 @@ void *encode_video_thread(void *arg) | |||
552 | } | 553 | } |
553 | 554 | ||
554 | pthread_mutex_lock(&cs->rtp_msg_mutex_lock); | 555 | pthread_mutex_lock(&cs->rtp_msg_mutex_lock); |
555 | THREADLOCK() | ||
556 | 556 | ||
557 | if (!enc_video_packet.data) fprintf(stderr, "video packet data is NULL\n"); | 557 | if (!enc_video_packet.data) fprintf(stderr, "video packet data is NULL\n"); |
558 | 558 | ||
559 | s_video_msg = rtp_msg_new ( cs->_rtp_video, enc_video_packet.data, enc_video_packet.size ) ; | 559 | if ( 0 > rtp_send_msg ( cs->_rtp_video, cs->_messenger, enc_video_packet.data, enc_video_packet.size) ) { |
560 | |||
561 | if (!s_video_msg) { | ||
562 | printf("invalid message\n"); | 560 | printf("invalid message\n"); |
563 | } | 561 | } |
564 | 562 | ||
565 | rtp_send_msg ( cs->_rtp_video, s_video_msg, cs->_networking ); | ||
566 | THREADUNLOCK() | ||
567 | pthread_mutex_unlock(&cs->rtp_msg_mutex_lock); | 563 | pthread_mutex_unlock(&cs->rtp_msg_mutex_lock); |
568 | av_free_packet(&enc_video_packet); | 564 | av_free_packet(&enc_video_packet); |
569 | } | 565 | } |
@@ -587,7 +583,7 @@ void *encode_video_thread(void *arg) | |||
587 | void *encode_audio_thread(void *arg) | 583 | void *encode_audio_thread(void *arg) |
588 | { | 584 | { |
589 | codec_state *cs = (codec_state *)arg; | 585 | codec_state *cs = (codec_state *)arg; |
590 | rtp_msg_t *s_audio_msg; | 586 | RTPMessage *s_audio_msg; |
591 | unsigned char encoded_data[4096]; | 587 | unsigned char encoded_data[4096]; |
592 | int encoded_size = 0; | 588 | int encoded_size = 0; |
593 | int16_t frame[4096]; | 589 | int16_t frame[4096]; |
@@ -606,12 +602,11 @@ void *encode_audio_thread(void *arg) | |||
606 | printf("Could not encode audio packet\n"); | 602 | printf("Could not encode audio packet\n"); |
607 | } else { | 603 | } else { |
608 | pthread_mutex_lock(&cs->rtp_msg_mutex_lock); | 604 | pthread_mutex_lock(&cs->rtp_msg_mutex_lock); |
609 | THREADLOCK() | 605 | |
610 | rtp_set_payload_type(cs->_rtp_audio, 96); | 606 | rtp_send_msg ( cs->_rtp_audio, cs->_messenger, encoded_data, encoded_size ); |
611 | s_audio_msg = rtp_msg_new (cs->_rtp_audio, encoded_data, encoded_size) ; | 607 | |
612 | rtp_send_msg ( cs->_rtp_audio, s_audio_msg, cs->_networking ); | ||
613 | pthread_mutex_unlock(&cs->rtp_msg_mutex_lock); | 608 | pthread_mutex_unlock(&cs->rtp_msg_mutex_lock); |
614 | THREADUNLOCK() | 609 | |
615 | } | 610 | } |
616 | } else { | 611 | } else { |
617 | usleep(1000); | 612 | usleep(1000); |
@@ -646,7 +641,7 @@ void *decode_video_thread(void *arg) | |||
646 | { | 641 | { |
647 | codec_state *cs = (codec_state *)arg; | 642 | codec_state *cs = (codec_state *)arg; |
648 | cs->video_stream = 0; | 643 | cs->video_stream = 0; |
649 | rtp_msg_t *r_msg; | 644 | RTPMessage *r_msg; |
650 | int dec_frame_finished; | 645 | int dec_frame_finished; |
651 | AVFrame *r_video_frame; | 646 | AVFrame *r_video_frame; |
652 | r_video_frame = avcodec_alloc_frame(); | 647 | r_video_frame = avcodec_alloc_frame(); |
@@ -659,8 +654,8 @@ void *decode_video_thread(void *arg) | |||
659 | r_msg = rtp_recv_msg ( cs->_rtp_video ); | 654 | r_msg = rtp_recv_msg ( cs->_rtp_video ); |
660 | 655 | ||
661 | if (r_msg) { | 656 | if (r_msg) { |
662 | memcpy(dec_video_packet.data, r_msg->_data, r_msg->_length); | 657 | memcpy(dec_video_packet.data, r_msg->data, r_msg->length); |
663 | dec_video_packet.size = r_msg->_length; | 658 | dec_video_packet.size = r_msg->length; |
664 | avcodec_decode_video2(cs->video_decoder_ctx, r_video_frame, &dec_frame_finished, &dec_video_packet); | 659 | avcodec_decode_video2(cs->video_decoder_ctx, r_video_frame, &dec_frame_finished, &dec_video_packet); |
665 | 660 | ||
666 | if (dec_frame_finished) { | 661 | if (dec_frame_finished) { |
@@ -695,7 +690,7 @@ void *decode_video_thread(void *arg) | |||
695 | void *decode_audio_thread(void *arg) | 690 | void *decode_audio_thread(void *arg) |
696 | { | 691 | { |
697 | codec_state *cs = (codec_state *)arg; | 692 | codec_state *cs = (codec_state *)arg; |
698 | rtp_msg_t *r_msg; | 693 | RTPMessage *r_msg; |
699 | 694 | ||
700 | int frame_size = AUDIO_FRAME_SIZE; | 695 | int frame_size = AUDIO_FRAME_SIZE; |
701 | int data_size; | 696 | int data_size; |
@@ -747,7 +742,7 @@ void *decode_audio_thread(void *arg) | |||
747 | opus_int16 PCM[frame_size]; | 742 | opus_int16 PCM[frame_size]; |
748 | 743 | ||
749 | while (!cs->quit && cs->receive_audio) { | 744 | while (!cs->quit && cs->receive_audio) { |
750 | THREADLOCK() | 745 | |
751 | r_msg = rtp_recv_msg ( cs->_rtp_audio ); | 746 | r_msg = rtp_recv_msg ( cs->_rtp_audio ); |
752 | 747 | ||
753 | if (r_msg) { | 748 | if (r_msg) { |
@@ -765,7 +760,7 @@ void *decode_audio_thread(void *arg) | |||
765 | if (success > 0) { | 760 | if (success > 0) { |
766 | /* good packet */ | 761 | /* good packet */ |
767 | if (success == 1) { | 762 | if (success == 1) { |
768 | dec_frame_len = opus_decode(cs->audio_decoder, r_msg->_data, r_msg->_length, PCM, frame_size, 0); | 763 | dec_frame_len = opus_decode(cs->audio_decoder, r_msg->data, r_msg->length, PCM, frame_size, 0); |
769 | rtp_free_msg(cs->_rtp_audio, r_msg); | 764 | rtp_free_msg(cs->_rtp_audio, r_msg); |
770 | } | 765 | } |
771 | 766 | ||
@@ -806,8 +801,7 @@ void *decode_audio_thread(void *arg) | |||
806 | 801 | ||
807 | } | 802 | } |
808 | } | 803 | } |
809 | 804 | ||
810 | THREADUNLOCK() | ||
811 | usleep(1000); | 805 | usleep(1000); |
812 | } | 806 | } |
813 | 807 | ||
diff --git a/toxav/toxmedia.h b/toxav/toxmedia.h index 5037365c..aad299bb 100644 --- a/toxav/toxmedia.h +++ b/toxav/toxmedia.h | |||
@@ -70,7 +70,7 @@ | |||
70 | #define DEFAULT_WEBCAM "/dev/video0" | 70 | #define DEFAULT_WEBCAM "/dev/video0" |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #ifdef defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | 73 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) |
74 | #define VIDEO_DRIVER "vfwcap" | 74 | #define VIDEO_DRIVER "vfwcap" |
75 | #define DEFAULT_WEBCAM "0" | 75 | #define DEFAULT_WEBCAM "0" |
76 | #endif | 76 | #endif |
@@ -126,11 +126,11 @@ typedef struct { | |||
126 | /* rendered video picture, ready for display */ | 126 | /* rendered video picture, ready for display */ |
127 | VideoPicture video_picture; | 127 | VideoPicture video_picture; |
128 | 128 | ||
129 | rtp_session_t *_rtp_video; | 129 | RTPSession *_rtp_video; |
130 | rtp_session_t *_rtp_audio; | 130 | RTPSession *_rtp_audio; |
131 | int socket; | ||
132 | Networking_Core *_networking; | ||
133 | 131 | ||
132 | Tox* _messenger; | ||
133 | |||
134 | pthread_t encode_audio_thread; | 134 | pthread_t encode_audio_thread; |
135 | pthread_t encode_video_thread; | 135 | pthread_t encode_video_thread; |
136 | 136 | ||
@@ -143,11 +143,8 @@ typedef struct { | |||
143 | uint8_t quit; | 143 | uint8_t quit; |
144 | SDL_Event SDL_event; | 144 | SDL_Event SDL_event; |
145 | 145 | ||
146 | msi_session_t *_msi; | 146 | MSISession *_msi; |
147 | uint32_t _frame_rate; | 147 | uint32_t _frame_rate; |
148 | uint16_t _send_port, _recv_port; | ||
149 | int _tox_sock; | ||
150 | //pthread_id _medialoop_id; | ||
151 | 148 | ||
152 | } codec_state; | 149 | } codec_state; |
153 | 150 | ||
@@ -161,7 +158,7 @@ int video_encoder_refresh(codec_state *cs, int bps); | |||
161 | void *encode_video_thread(void *arg); | 158 | void *encode_video_thread(void *arg); |
162 | void *encode_audio_thread(void *arg); | 159 | void *encode_audio_thread(void *arg); |
163 | int video_decoder_refresh(codec_state *cs, int width, int height); | 160 | int video_decoder_refresh(codec_state *cs, int width, int height); |
164 | int handle_rtp_video_packet(codec_state *cs, rtp_msg_t *r_msg); | 161 | int handle_rtp_video_packet(codec_state *cs, RTPMessage *r_msg); |
165 | void *decode_video_thread(void *arg); | 162 | void *decode_video_thread(void *arg); |
166 | void *decode_audio_thread(void *arg); | 163 | void *decode_audio_thread(void *arg); |
167 | 164 | ||
diff --git a/toxav/toxrtp.c b/toxav/toxrtp.c index 2363deea..03d20363 100755 --- a/toxav/toxrtp.c +++ b/toxav/toxrtp.c | |||
@@ -39,8 +39,6 @@ | |||
39 | #define PAYLOAD_ID_VALUE_OPUS 1 | 39 | #define PAYLOAD_ID_VALUE_OPUS 1 |
40 | #define PAYLOAD_ID_VALUE_VP8 2 | 40 | #define PAYLOAD_ID_VALUE_VP8 2 |
41 | 41 | ||
42 | #define MAX_SEQU_NUM 65535 | ||
43 | |||
44 | #define size_32 4 | 42 | #define size_32 4 |
45 | 43 | ||
46 | #define inline__ inline __attribute__((always_inline)) | 44 | #define inline__ inline __attribute__((always_inline)) |
diff --git a/toxav/toxrtp.h b/toxav/toxrtp.h index b4275aba..bb40f343 100755 --- a/toxav/toxrtp.h +++ b/toxav/toxrtp.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <inttypes.h> | 29 | #include <inttypes.h> |
30 | #include "../toxcore/tox.h" | 30 | #include "../toxcore/tox.h" |
31 | 31 | ||
32 | #define MAX_SEQU_NUM 65535 | ||
33 | |||
32 | /** | 34 | /** |
33 | * Standard rtp header | 35 | * Standard rtp header |
34 | */ | 36 | */ |
diff --git a/toxcore/Makefile.inc b/toxcore/Makefile.inc index 6c4e297f..c9e94911 100644 --- a/toxcore/Makefile.inc +++ b/toxcore/Makefile.inc | |||
@@ -29,8 +29,8 @@ libtoxcore_la_SOURCES = ../toxcore/DHT.h \ | |||
29 | ../toxcore/group_chats.c \ | 29 | ../toxcore/group_chats.c \ |
30 | ../toxcore/assoc.h \ | 30 | ../toxcore/assoc.h \ |
31 | ../toxcore/assoc.c \ | 31 | ../toxcore/assoc.c \ |
32 | ../toxcore/event.h \ | 32 | ../toxcore/event.h \ |
33 | ../toxcore/event.c \ | 33 | ../toxcore/event.c \ |
34 | ../toxcore/onion.h \ | 34 | ../toxcore/onion.h \ |
35 | ../toxcore/onion.c \ | 35 | ../toxcore/onion.c \ |
36 | ../toxcore/onion_announce.h \ | 36 | ../toxcore/onion_announce.h \ |
@@ -42,7 +42,8 @@ libtoxcore_la_SOURCES = ../toxcore/DHT.h \ | |||
42 | libtoxcore_la_CFLAGS = -I$(top_srcdir) \ | 42 | libtoxcore_la_CFLAGS = -I$(top_srcdir) \ |
43 | -I$(top_srcdir)/toxcore \ | 43 | -I$(top_srcdir)/toxcore \ |
44 | $(LIBSODIUM_CFLAGS) \ | 44 | $(LIBSODIUM_CFLAGS) \ |
45 | $(NACL_CFLAGS) | 45 | $(NACL_CFLAGS) \ |
46 | $(PTHREAD_CFLAGS) | ||
46 | 47 | ||
47 | libtoxcore_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \ | 48 | libtoxcore_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \ |
48 | $(EXTRA_LT_LDFLAGS) \ | 49 | $(EXTRA_LT_LDFLAGS) \ |
@@ -51,4 +52,5 @@ libtoxcore_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \ | |||
51 | $(WINSOCK2_LIBS) | 52 | $(WINSOCK2_LIBS) |
52 | 53 | ||
53 | libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) \ | 54 | libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) \ |
54 | $(NAC_LIBS) | 55 | $(NAC_LIBS) \ |
56 | $(PTHREAD_LIBS) | ||