move media reset code a little deeper so it does not interrupt media when there is no change
This commit is contained in:
parent
9d2400b7ab
commit
98d453c7d9
|
@ -1469,29 +1469,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
|
|||
engine->read_impl.samples_per_packet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
engine->check_frames = 0;
|
||||
engine->last_ts = 0;
|
||||
|
||||
switch_channel_audio_sync(session->channel);
|
||||
do_cng = 1;
|
||||
}
|
||||
|
||||
|
@ -1995,6 +1976,22 @@ 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);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"Changing Codec from %s@%dms@%dhz to %s@%dms@%luhz\n",
|
||||
|
|
Loading…
Reference in New Issue