[mod_av] enable resampler when sample rate mismatch (#153)
This commit is contained in:
parent
3c5773719e
commit
9875e190aa
|
@ -702,7 +702,7 @@ GCC_DIAG_ON(deprecated-declarations)
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sample_rate: %d nb_samples: %d\n", mst->frame->sample_rate, mst->frame->nb_samples);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sample_rate: %d nb_samples: %d\n", mst->frame->sample_rate, mst->frame->nb_samples);
|
||||||
|
|
||||||
if (c->sample_fmt != AV_SAMPLE_FMT_S16) {
|
if (c->sample_fmt != AV_SAMPLE_FMT_S16 || c->sample_rate != mst->sample_rate) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sample_fmt %d != AV_SAMPLE_FMT_S16, start resampler\n", c->sample_fmt);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sample_fmt %d != AV_SAMPLE_FMT_S16, start resampler\n", c->sample_fmt);
|
||||||
|
|
||||||
mst->resample_ctx = swr_alloc();
|
mst->resample_ctx = swr_alloc();
|
||||||
|
@ -1231,7 +1231,7 @@ GCC_DIAG_ON(deprecated-declarations)
|
||||||
context->audio_st[1].sample_rate = handle->samplerate;
|
context->audio_st[1].sample_rate = handle->samplerate;
|
||||||
|
|
||||||
GCC_DIAG_OFF(deprecated-declarations)
|
GCC_DIAG_OFF(deprecated-declarations)
|
||||||
if (context->audio_st[0].st->codec->sample_fmt != AV_SAMPLE_FMT_S16) {
|
if (context->audio_st[0].st->codec->sample_fmt != AV_SAMPLE_FMT_S16 || context->audio_st[0].st->codec->sample_rate != handle->samplerate) {
|
||||||
GCC_DIAG_ON(deprecated-declarations)
|
GCC_DIAG_ON(deprecated-declarations)
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < context->has_audio && x < 2 && c[x]; x++) {
|
for (x = 0; x < context->has_audio && x < 2 && c[x]; x++) {
|
||||||
|
|
Loading…
Reference in New Issue