diff options
-rw-r--r-- | auto_tests/toxav_basic_test.c | 4 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 10 | ||||
-rw-r--r-- | testing/av_test.c | 23 | ||||
-rw-r--r-- | toxav/audio.c | 4 |
4 files changed, 19 insertions, 22 deletions
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index a3847640..abe5d034 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -66,8 +66,8 @@ void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, vo | |||
66 | } | 66 | } |
67 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, | 67 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, |
68 | uint16_t width, uint16_t height, | 68 | uint16_t width, uint16_t height, |
69 | uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a, | 69 | uint8_t const *y, uint8_t const *u, uint8_t const *v, |
70 | int32_t ystride, int32_t ustride, int32_t vstride, int32_t astride, | 70 | int32_t ystride, int32_t ustride, int32_t vstride, |
71 | void *user_data) | 71 | void *user_data) |
72 | { | 72 | { |
73 | (void) av; | 73 | (void) av; |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 761a4525..438f2789 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -61,8 +61,8 @@ void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, vo | |||
61 | } | 61 | } |
62 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, | 62 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, |
63 | uint16_t width, uint16_t height, | 63 | uint16_t width, uint16_t height, |
64 | uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a, | 64 | uint8_t const *y, uint8_t const *u, uint8_t const *v, |
65 | int32_t ystride, int32_t ustride, int32_t vstride, int32_t stride, | 65 | int32_t ystride, int32_t ustride, int32_t vstride, |
66 | void *user_data) | 66 | void *user_data) |
67 | { | 67 | { |
68 | (void) av; | 68 | (void) av; |
@@ -159,13 +159,11 @@ void* call_thread(void* pd) | |||
159 | uint8_t video_y[800*600]; | 159 | uint8_t video_y[800*600]; |
160 | uint8_t video_u[800*600 / 2]; | 160 | uint8_t video_u[800*600 / 2]; |
161 | uint8_t video_v[800*600 / 2]; | 161 | uint8_t video_v[800*600 / 2]; |
162 | uint8_t video_a[800*600]; | ||
163 | 162 | ||
164 | memset(PCM, 0, sizeof(PCM)); | 163 | memset(PCM, 0, sizeof(PCM)); |
165 | memset(video_y, 0, sizeof(video_y)); | 164 | memset(video_y, 0, sizeof(video_y)); |
166 | memset(video_u, 0, sizeof(video_u)); | 165 | memset(video_u, 0, sizeof(video_u)); |
167 | memset(video_v, 0, sizeof(video_v)); | 166 | memset(video_v, 0, sizeof(video_v)); |
168 | memset(video_a, 0, sizeof(video_a)); | ||
169 | 167 | ||
170 | time_t start_time = time(NULL); | 168 | time_t start_time = time(NULL); |
171 | while(time(NULL) - start_time < 4) { | 169 | while(time(NULL) - start_time < 4) { |
@@ -175,8 +173,8 @@ void* call_thread(void* pd) | |||
175 | toxav_audio_send_frame(AliceAV, friend_number, PCM, 960, 1, 48000, NULL); | 173 | toxav_audio_send_frame(AliceAV, friend_number, PCM, 960, 1, 48000, NULL); |
176 | toxav_audio_send_frame(BobAV, 0, PCM, 960, 1, 48000, NULL); | 174 | toxav_audio_send_frame(BobAV, 0, PCM, 960, 1, 48000, NULL); |
177 | 175 | ||
178 | toxav_video_send_frame(AliceAV, friend_number, 800, 600, video_y, video_u, video_v, video_a, NULL); | 176 | toxav_video_send_frame(AliceAV, friend_number, 800, 600, video_y, video_u, video_v, NULL); |
179 | toxav_video_send_frame(BobAV, 0, 800, 600, video_y, video_u, video_v, video_a, NULL); | 177 | toxav_video_send_frame(BobAV, 0, 800, 600, video_y, video_u, video_v, NULL); |
180 | 178 | ||
181 | c_sleep(10); | 179 | c_sleep(10); |
182 | } | 180 | } |
diff --git a/testing/av_test.c b/testing/av_test.c index de973d91..cd9608b6 100644 --- a/testing/av_test.c +++ b/testing/av_test.c | |||
@@ -70,8 +70,8 @@ | |||
70 | #define YUV2B(Y, U, V) CLIP(( 298 * C(Y) + 516 * D(U) + 128) >> 8) | 70 | #define YUV2B(Y, U, V) CLIP(( 298 * C(Y) + 516 * D(U) + 128) >> 8) |
71 | 71 | ||
72 | 72 | ||
73 | #define TEST_TRANSFER_A 0 | 73 | #define TEST_TRANSFER_A 1 |
74 | #define TEST_TRANSFER_V 1 | 74 | #define TEST_TRANSFER_V 0 |
75 | 75 | ||
76 | 76 | ||
77 | typedef struct { | 77 | typedef struct { |
@@ -134,14 +134,13 @@ void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, vo | |||
134 | } | 134 | } |
135 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, | 135 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, |
136 | uint16_t width, uint16_t height, | 136 | uint16_t width, uint16_t height, |
137 | uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a, | 137 | uint8_t const *y, uint8_t const *u, uint8_t const *v, |
138 | int32_t ystride, int32_t ustride, int32_t vstride, int32_t astride, | 138 | int32_t ystride, int32_t ustride, int32_t vstride, |
139 | void *user_data) | 139 | void *user_data) |
140 | { | 140 | { |
141 | ystride = abs(ystride); | 141 | ystride = abs(ystride); |
142 | ustride = abs(ustride); | 142 | ustride = abs(ustride); |
143 | vstride = abs(vstride); | 143 | vstride = abs(vstride); |
144 | astride = abs(astride); | ||
145 | 144 | ||
146 | uint16_t *img_data = malloc(height * width * 6); | 145 | uint16_t *img_data = malloc(height * width * 6); |
147 | 146 | ||
@@ -177,9 +176,9 @@ void t_toxav_receive_audio_frame_cb(ToxAV *av, uint32_t friend_number, | |||
177 | void *user_data) | 176 | void *user_data) |
178 | { | 177 | { |
179 | CallControl* cc = user_data; | 178 | CallControl* cc = user_data; |
180 | frame* f = malloc(sizeof(uint16_t) + sample_count * sizeof(int16_t)); | 179 | frame* f = malloc(sizeof(uint16_t) + sample_count * sizeof(int16_t) * channels); |
181 | memcpy(f->data, pcm, sample_count * sizeof(int16_t)); | 180 | memcpy(f->data, pcm, sample_count * sizeof(int16_t) * channels); |
182 | f->size = sample_count/channels; | 181 | f->size = sample_count; |
183 | 182 | ||
184 | pthread_mutex_lock(cc->arb_mutex); | 183 | pthread_mutex_lock(cc->arb_mutex); |
185 | free(rb_write(cc->arb, f)); | 184 | free(rb_write(cc->arb, f)); |
@@ -225,15 +224,15 @@ void initialize_tox(Tox** bootstrap, ToxAV** AliceAV, CallControl* AliceCC, ToxA | |||
225 | TOX_ERR_NEW error; | 224 | TOX_ERR_NEW error; |
226 | 225 | ||
227 | opts.start_port = 33445; | 226 | opts.start_port = 33445; |
228 | *bootstrap = tox_new(&opts, NULL, 0, &error); | 227 | *bootstrap = tox_new(&opts, &error); |
229 | assert(error == TOX_ERR_NEW_OK); | 228 | assert(error == TOX_ERR_NEW_OK); |
230 | 229 | ||
231 | opts.start_port = 33455; | 230 | opts.start_port = 33455; |
232 | Alice = tox_new(&opts, NULL, 0, &error); | 231 | Alice = tox_new(&opts, &error); |
233 | assert(error == TOX_ERR_NEW_OK); | 232 | assert(error == TOX_ERR_NEW_OK); |
234 | 233 | ||
235 | opts.start_port = 33465; | 234 | opts.start_port = 33465; |
236 | Bob = tox_new(&opts, NULL, 0, &error); | 235 | Bob = tox_new(&opts, &error); |
237 | assert(error == TOX_ERR_NEW_OK); | 236 | assert(error == TOX_ERR_NEW_OK); |
238 | } | 237 | } |
239 | 238 | ||
@@ -369,7 +368,7 @@ int send_opencv_img(ToxAV* av, uint32_t friend_number, const IplImage* img) | |||
369 | } | 368 | } |
370 | 369 | ||
371 | 370 | ||
372 | int rc = toxav_video_send_frame(av, friend_number, img->width, img->height, planes[0], planes[1], planes[2], NULL, NULL); | 371 | int rc = toxav_video_send_frame(av, friend_number, img->width, img->height, planes[0], planes[1], planes[2], NULL); |
373 | free(planes[0]); | 372 | free(planes[0]); |
374 | free(planes[1]); | 373 | free(planes[1]); |
375 | free(planes[2]); | 374 | free(planes[2]); |
diff --git a/toxav/audio.c b/toxav/audio.c index f6993a1d..0a6f04e3 100644 --- a/toxav/audio.c +++ b/toxav/audio.c | |||
@@ -181,8 +181,8 @@ void ac_do(ACSession* ac) | |||
181 | } else if (ac->acb.first) { | 181 | } else if (ac->acb.first) { |
182 | ac->last_packet_frame_duration = (rc * 1000) / ac->last_packet_sampling_rate; | 182 | ac->last_packet_frame_duration = (rc * 1000) / ac->last_packet_sampling_rate; |
183 | 183 | ||
184 | ac->acb.first(ac->av, ac->friend_number, tmp, rc * ac->last_packet_channel_count, | 184 | ac->acb.first(ac->av, ac->friend_number, tmp, rc, ac->last_packet_channel_count, |
185 | ac->last_packet_channel_count, ac->last_packet_sampling_rate, ac->acb.second); | 185 | ac->last_packet_sampling_rate, ac->acb.second); |
186 | } | 186 | } |
187 | 187 | ||
188 | return; | 188 | return; |