[core] Remove unused buffers and mutexes in switch_core_session. Remove destruction of resamplers that will already be destroyed by switch_core_session_reset().
This commit is contained in:
parent
dfb9541b08
commit
c63f9524ee
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@ -135,8 +135,6 @@ struct switch_core_session {
|
|||
switch_mutex_t *codec_init_mutex;
|
||||
switch_mutex_t *codec_read_mutex;
|
||||
switch_mutex_t *codec_write_mutex;
|
||||
switch_mutex_t *video_codec_read_mutex;
|
||||
switch_mutex_t *video_codec_write_mutex;
|
||||
switch_thread_cond_t *cond;
|
||||
switch_mutex_t *frame_read_mutex;
|
||||
|
||||
|
@ -170,15 +168,6 @@ struct switch_core_session {
|
|||
uint8_t raw_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
uint8_t enc_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
|
||||
/* video frame.data being trated differently than audio, allocate a dynamic data buffer if necessary*/
|
||||
switch_buffer_t *video_raw_write_buffer;
|
||||
switch_frame_t video_raw_write_frame;
|
||||
// switch_frame_t video_enc_write_frame;
|
||||
|
||||
switch_buffer_t *video_raw_read_buffer;
|
||||
switch_frame_t video_raw_read_frame;
|
||||
// switch_frame_t video_enc_read_frame;
|
||||
|
||||
switch_codec_t bug_codec;
|
||||
uint32_t read_frame_count;
|
||||
uint32_t track_duration;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@ -3583,7 +3583,6 @@ static void switch_core_session_parse_codec_settings(switch_core_session_t *sess
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//?
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_session_t *session, int force)
|
||||
{
|
||||
|
@ -3727,20 +3726,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
|
|||
(uint32_t) a_engine->read_impl.microseconds_per_packet / 1000 != a_engine->cur_payload_map->codec_ms ||
|
||||
a_engine->read_impl.samples_per_second != a_engine->cur_payload_map->rm_rate ) {
|
||||
|
||||
if (session->read_resampler) {
|
||||
switch_mutex_lock(session->resample_mutex);
|
||||
switch_resample_destroy(&session->read_resampler);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Deactivating read resampler\n");
|
||||
switch_mutex_unlock(session->resample_mutex);
|
||||
}
|
||||
|
||||
if (session->write_resampler) {
|
||||
switch_mutex_lock(session->resample_mutex);
|
||||
switch_resample_destroy(&session->write_resampler);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Deactivating write resampler\n");
|
||||
switch_mutex_unlock(session->resample_mutex);
|
||||
}
|
||||
|
||||
switch_core_session_reset(session, 0, 0);
|
||||
switch_channel_audio_sync(session->channel);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@ -1393,17 +1393,6 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s
|
|||
switch_buffer_destroy(&session->raw_read_buffer);
|
||||
switch_mutex_unlock(session->codec_read_mutex);
|
||||
|
||||
switch_mutex_lock(session->video_codec_write_mutex);
|
||||
switch_buffer_destroy(&session->video_raw_write_buffer);
|
||||
switch_mutex_unlock(session->video_codec_write_mutex);
|
||||
|
||||
switch_mutex_lock(session->video_codec_read_mutex);
|
||||
switch_buffer_destroy(&session->video_raw_read_buffer);
|
||||
switch_mutex_unlock(session->video_codec_read_mutex);
|
||||
|
||||
//video_raw_read_frame.data is dynamically allocated if necessary, so wipe this also
|
||||
switch_safe_free(session->video_raw_read_frame.data);
|
||||
|
||||
if (flush_dtmf) {
|
||||
while ((has = switch_channel_has_dtmf(channel))) {
|
||||
switch_channel_flush_dtmf(channel);
|
||||
|
@ -2424,8 +2413,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
|
|||
switch_mutex_init(&session->codec_init_mutex, SWITCH_MUTEX_NESTED, session->pool);
|
||||
switch_mutex_init(&session->codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
|
||||
switch_mutex_init(&session->codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool);
|
||||
switch_mutex_init(&session->video_codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
|
||||
switch_mutex_init(&session->video_codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool);
|
||||
switch_mutex_init(&session->frame_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
|
||||
switch_thread_rwlock_create(&session->bug_rwlock, session->pool);
|
||||
switch_thread_cond_create(&session->cond, session->pool);
|
||||
|
|
Loading…
Reference in New Issue