提交 98d453c7 authored 作者: Anthony Minessale's avatar Anthony Minessale

move media reset code a little deeper so it does not interrupt media when there is no change

上级 9d2400b7
......@@ -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",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论