diff options
Diffstat (limited to 'toxav')
-rw-r--r-- | toxav/codec.c | 10 | ||||
-rw-r--r-- | toxav/codec.h | 11 | ||||
-rw-r--r-- | toxav/toxav.c | 36 |
3 files changed, 32 insertions, 25 deletions
diff --git a/toxav/codec.c b/toxav/codec.c index 1e8478bb..ed1ee44e 100644 --- a/toxav/codec.c +++ b/toxav/codec.c | |||
@@ -151,6 +151,7 @@ int init_audio_decoder(CodecState *cs, uint32_t audio_channels) | |||
151 | return -1; | 151 | return -1; |
152 | } | 152 | } |
153 | 153 | ||
154 | cs->audio_decoder_channels = audio_channels; | ||
154 | return 0; | 155 | return 0; |
155 | } | 156 | } |
156 | 157 | ||
@@ -261,7 +262,7 @@ int init_audio_encoder(CodecState *cs, uint32_t audio_channels) | |||
261 | return -1; | 262 | return -1; |
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | cs->audio_encoder_channels = audio_channels; | |
265 | return 0; | 266 | return 0; |
266 | } | 267 | } |
267 | 268 | ||
@@ -269,7 +270,8 @@ int init_audio_encoder(CodecState *cs, uint32_t audio_channels) | |||
269 | CodecState *codec_init_session ( uint32_t audio_bitrate, | 270 | CodecState *codec_init_session ( uint32_t audio_bitrate, |
270 | uint16_t audio_frame_duration, | 271 | uint16_t audio_frame_duration, |
271 | uint32_t audio_sample_rate, | 272 | uint32_t audio_sample_rate, |
272 | uint32_t audio_channels, | 273 | uint32_t encoder_audio_channels, |
274 | uint32_t decoder_audio_channels, | ||
273 | uint32_t audio_VAD_tolerance_ms, | 275 | uint32_t audio_VAD_tolerance_ms, |
274 | uint16_t max_video_width, | 276 | uint16_t max_video_width, |
275 | uint16_t max_video_height, | 277 | uint16_t max_video_height, |
@@ -292,8 +294,8 @@ CodecState *codec_init_session ( uint32_t audio_bitrate, | |||
292 | retu->capabilities |= ( 0 == init_video_decoder(retu) ) ? v_decoding : 0; | 294 | retu->capabilities |= ( 0 == init_video_decoder(retu) ) ? v_decoding : 0; |
293 | } | 295 | } |
294 | 296 | ||
295 | retu->capabilities |= ( 0 == init_audio_encoder(retu, audio_channels) ) ? a_encoding : 0; | 297 | retu->capabilities |= ( 0 == init_audio_encoder(retu, encoder_audio_channels) ) ? a_encoding : 0; |
296 | retu->capabilities |= ( 0 == init_audio_decoder(retu, audio_channels) ) ? a_decoding : 0; | 298 | retu->capabilities |= ( 0 == init_audio_decoder(retu, decoder_audio_channels) ) ? a_decoding : 0; |
297 | 299 | ||
298 | if ( retu->capabilities == 0 ) { /* everything failed */ | 300 | if ( retu->capabilities == 0 ) { /* everything failed */ |
299 | free (retu); | 301 | free (retu); |
diff --git a/toxav/codec.h b/toxav/codec.h index 755673f3..dceeea7a 100644 --- a/toxav/codec.h +++ b/toxav/codec.h | |||
@@ -64,9 +64,11 @@ typedef struct _CodecState { | |||
64 | OpusEncoder *audio_encoder; | 64 | OpusEncoder *audio_encoder; |
65 | int audio_bitrate; | 65 | int audio_bitrate; |
66 | int audio_sample_rate; | 66 | int audio_sample_rate; |
67 | int audio_encoder_channels; | ||
67 | 68 | ||
68 | /* audio decoding */ | 69 | /* audio decoding */ |
69 | OpusDecoder *audio_decoder; | 70 | OpusDecoder *audio_decoder; |
71 | int audio_decoder_channels; | ||
70 | 72 | ||
71 | uint64_t capabilities; /* supports*/ | 73 | uint64_t capabilities; /* supports*/ |
72 | 74 | ||
@@ -93,11 +95,12 @@ RTPMessage *dequeue(JitterBuffer *q, int *success); | |||
93 | CodecState *codec_init_session ( uint32_t audio_bitrate, | 95 | CodecState *codec_init_session ( uint32_t audio_bitrate, |
94 | uint16_t audio_frame_duration, | 96 | uint16_t audio_frame_duration, |
95 | uint32_t audio_sample_rate, | 97 | uint32_t audio_sample_rate, |
96 | uint32_t audio_channels, | 98 | uint32_t encoder_audio_channels, |
99 | uint32_t decoder_audio_channels, | ||
97 | uint32_t audio_VAD_tolerance_ms, | 100 | uint32_t audio_VAD_tolerance_ms, |
98 | uint16_t video_width, | 101 | uint16_t max_video_width, |
99 | uint16_t video_height, | 102 | uint16_t max_video_height, |
100 | uint32_t video_bitrate); | 103 | uint32_t video_bitrate ); |
101 | 104 | ||
102 | void codec_terminate_session(CodecState *cs); | 105 | void codec_terminate_session(CodecState *cs); |
103 | 106 | ||
diff --git a/toxav/toxav.c b/toxav/toxav.c index 1e5847a4..1a25a82f 100644 --- a/toxav/toxav.c +++ b/toxav/toxav.c | |||
@@ -432,7 +432,8 @@ int toxav_prepare_transmission ( ToxAv *av, int32_t call_index, uint32_t jbuf_ca | |||
432 | goto error; | 432 | goto error; |
433 | } | 433 | } |
434 | 434 | ||
435 | ToxAvCSettings csettings = toxavcsettings_cast(&av->msi_session->calls[call_index]->csettings_peer[0]); | 435 | ToxAvCSettings csettings_peer = toxavcsettings_cast(&av->msi_session->calls[call_index]->csettings_peer[0]); |
436 | ToxAvCSettings csettings_local = toxavcsettings_cast(&av->msi_session->calls[call_index]->csettings_local); | ||
436 | LOGGER_DEBUG( | 437 | LOGGER_DEBUG( |
437 | "Type: %u \n" | 438 | "Type: %u \n" |
438 | "Video bitrate: %u \n" | 439 | "Video bitrate: %u \n" |
@@ -442,23 +443,24 @@ int toxav_prepare_transmission ( ToxAv *av, int32_t call_index, uint32_t jbuf_ca | |||
442 | "Audio framedur: %u \n" | 443 | "Audio framedur: %u \n" |
443 | "Audio sample rate: %u \n" | 444 | "Audio sample rate: %u \n" |
444 | "Audio channels: %u \n", | 445 | "Audio channels: %u \n", |
445 | csettings.call_type, | 446 | csettings_peer.call_type, |
446 | csettings.video_bitrate, | 447 | csettings_peer.video_bitrate, |
447 | csettings.max_video_height, | 448 | csettings_peer.max_video_height, |
448 | csettings.max_video_width, | 449 | csettings_peer.max_video_width, |
449 | csettings.audio_bitrate, | 450 | csettings_peer.audio_bitrate, |
450 | csettings.audio_frame_duration, | 451 | csettings_peer.audio_frame_duration, |
451 | csettings.audio_sample_rate, | 452 | csettings_peer.audio_sample_rate, |
452 | csettings.audio_channels ); | 453 | csettings_peer.audio_channels ); |
453 | 454 | ||
454 | if ( (call->cs = codec_init_session(csettings.audio_bitrate, | 455 | if ( (call->cs = codec_init_session(csettings_local.audio_bitrate, |
455 | csettings.audio_frame_duration, | 456 | csettings_local.audio_frame_duration, |
456 | csettings.audio_sample_rate, | 457 | csettings_local.audio_sample_rate, |
457 | csettings.audio_channels, | 458 | csettings_local.audio_channels, |
459 | csettings_peer.audio_channels, | ||
458 | VAD_treshold, | 460 | VAD_treshold, |
459 | csettings.max_video_width, | 461 | csettings_local.max_video_width, |
460 | csettings.max_video_height, | 462 | csettings_local.max_video_height, |
461 | csettings.video_bitrate) )) { | 463 | csettings_local.video_bitrate) )) { |
462 | 464 | ||
463 | if ( pthread_mutex_init(&call->mutex, NULL) != 0 ) goto error; | 465 | if ( pthread_mutex_init(&call->mutex, NULL) != 0 ) goto error; |
464 | 466 | ||