summaryrefslogtreecommitdiff
path: root/testing/av_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/av_test.c')
-rw-r--r--testing/av_test.c23
1 files changed, 11 insertions, 12 deletions
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
77typedef struct { 77typedef struct {
@@ -134,14 +134,13 @@ void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, vo
134} 134}
135void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, 135void 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]);