mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Initialize codec session with right values.
Audio decoder and encoder channel values are sepparate values, the decoder should be set to the number of channels the other peer has his encoder set.
This commit is contained in:
parent
26bec89287
commit
8aa62cfef7
|
@ -151,6 +151,7 @@ int init_audio_decoder(CodecState *cs, uint32_t audio_channels)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cs->audio_decoder_channels = audio_channels;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +262,7 @@ int init_audio_encoder(CodecState *cs, uint32_t audio_channels)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cs->audio_encoder_channels = audio_channels;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +270,8 @@ int init_audio_encoder(CodecState *cs, uint32_t audio_channels)
|
||||||
CodecState *codec_init_session ( uint32_t audio_bitrate,
|
CodecState *codec_init_session ( uint32_t audio_bitrate,
|
||||||
uint16_t audio_frame_duration,
|
uint16_t audio_frame_duration,
|
||||||
uint32_t audio_sample_rate,
|
uint32_t audio_sample_rate,
|
||||||
uint32_t audio_channels,
|
uint32_t encoder_audio_channels,
|
||||||
|
uint32_t decoder_audio_channels,
|
||||||
uint32_t audio_VAD_tolerance_ms,
|
uint32_t audio_VAD_tolerance_ms,
|
||||||
uint16_t max_video_width,
|
uint16_t max_video_width,
|
||||||
uint16_t max_video_height,
|
uint16_t max_video_height,
|
||||||
|
@ -292,8 +294,8 @@ CodecState *codec_init_session ( uint32_t audio_bitrate,
|
||||||
retu->capabilities |= ( 0 == init_video_decoder(retu) ) ? v_decoding : 0;
|
retu->capabilities |= ( 0 == init_video_decoder(retu) ) ? v_decoding : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
retu->capabilities |= ( 0 == init_audio_encoder(retu, audio_channels) ) ? a_encoding : 0;
|
retu->capabilities |= ( 0 == init_audio_encoder(retu, encoder_audio_channels) ) ? a_encoding : 0;
|
||||||
retu->capabilities |= ( 0 == init_audio_decoder(retu, audio_channels) ) ? a_decoding : 0;
|
retu->capabilities |= ( 0 == init_audio_decoder(retu, decoder_audio_channels) ) ? a_decoding : 0;
|
||||||
|
|
||||||
if ( retu->capabilities == 0 ) { /* everything failed */
|
if ( retu->capabilities == 0 ) { /* everything failed */
|
||||||
free (retu);
|
free (retu);
|
||||||
|
|
|
@ -64,9 +64,11 @@ typedef struct _CodecState {
|
||||||
OpusEncoder *audio_encoder;
|
OpusEncoder *audio_encoder;
|
||||||
int audio_bitrate;
|
int audio_bitrate;
|
||||||
int audio_sample_rate;
|
int audio_sample_rate;
|
||||||
|
int audio_encoder_channels;
|
||||||
|
|
||||||
/* audio decoding */
|
/* audio decoding */
|
||||||
OpusDecoder *audio_decoder;
|
OpusDecoder *audio_decoder;
|
||||||
|
int audio_decoder_channels;
|
||||||
|
|
||||||
uint64_t capabilities; /* supports*/
|
uint64_t capabilities; /* supports*/
|
||||||
|
|
||||||
|
@ -93,10 +95,11 @@ RTPMessage *dequeue(JitterBuffer *q, int *success);
|
||||||
CodecState *codec_init_session ( uint32_t audio_bitrate,
|
CodecState *codec_init_session ( uint32_t audio_bitrate,
|
||||||
uint16_t audio_frame_duration,
|
uint16_t audio_frame_duration,
|
||||||
uint32_t audio_sample_rate,
|
uint32_t audio_sample_rate,
|
||||||
uint32_t audio_channels,
|
uint32_t encoder_audio_channels,
|
||||||
|
uint32_t decoder_audio_channels,
|
||||||
uint32_t audio_VAD_tolerance_ms,
|
uint32_t audio_VAD_tolerance_ms,
|
||||||
uint16_t video_width,
|
uint16_t max_video_width,
|
||||||
uint16_t video_height,
|
uint16_t max_video_height,
|
||||||
uint32_t video_bitrate );
|
uint32_t video_bitrate );
|
||||||
|
|
||||||
void codec_terminate_session(CodecState *cs);
|
void codec_terminate_session(CodecState *cs);
|
||||||
|
|
|
@ -432,7 +432,8 @@ int toxav_prepare_transmission ( ToxAv *av, int32_t call_index, uint32_t jbuf_ca
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxAvCSettings csettings = toxavcsettings_cast(&av->msi_session->calls[call_index]->csettings_peer[0]);
|
ToxAvCSettings csettings_peer = toxavcsettings_cast(&av->msi_session->calls[call_index]->csettings_peer[0]);
|
||||||
|
ToxAvCSettings csettings_local = toxavcsettings_cast(&av->msi_session->calls[call_index]->csettings_local);
|
||||||
LOGGER_DEBUG(
|
LOGGER_DEBUG(
|
||||||
"Type: %u \n"
|
"Type: %u \n"
|
||||||
"Video bitrate: %u \n"
|
"Video bitrate: %u \n"
|
||||||
|
@ -442,23 +443,24 @@ int toxav_prepare_transmission ( ToxAv *av, int32_t call_index, uint32_t jbuf_ca
|
||||||
"Audio framedur: %u \n"
|
"Audio framedur: %u \n"
|
||||||
"Audio sample rate: %u \n"
|
"Audio sample rate: %u \n"
|
||||||
"Audio channels: %u \n",
|
"Audio channels: %u \n",
|
||||||
csettings.call_type,
|
csettings_peer.call_type,
|
||||||
csettings.video_bitrate,
|
csettings_peer.video_bitrate,
|
||||||
csettings.max_video_height,
|
csettings_peer.max_video_height,
|
||||||
csettings.max_video_width,
|
csettings_peer.max_video_width,
|
||||||
csettings.audio_bitrate,
|
csettings_peer.audio_bitrate,
|
||||||
csettings.audio_frame_duration,
|
csettings_peer.audio_frame_duration,
|
||||||
csettings.audio_sample_rate,
|
csettings_peer.audio_sample_rate,
|
||||||
csettings.audio_channels );
|
csettings_peer.audio_channels );
|
||||||
|
|
||||||
if ( (call->cs = codec_init_session(csettings.audio_bitrate,
|
if ( (call->cs = codec_init_session(csettings_local.audio_bitrate,
|
||||||
csettings.audio_frame_duration,
|
csettings_local.audio_frame_duration,
|
||||||
csettings.audio_sample_rate,
|
csettings_local.audio_sample_rate,
|
||||||
csettings.audio_channels,
|
csettings_local.audio_channels,
|
||||||
|
csettings_peer.audio_channels,
|
||||||
VAD_treshold,
|
VAD_treshold,
|
||||||
csettings.max_video_width,
|
csettings_local.max_video_width,
|
||||||
csettings.max_video_height,
|
csettings_local.max_video_height,
|
||||||
csettings.video_bitrate) )) {
|
csettings_local.video_bitrate) )) {
|
||||||
|
|
||||||
if ( pthread_mutex_init(&call->mutex, NULL) != 0 ) goto error;
|
if ( pthread_mutex_init(&call->mutex, NULL) != 0 ) goto error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user