TT#28163 fix recording-daemon sample format selection for mixed output

reported in #462

Change-Id: Iea7f1e421d15375768a1f76dd36e5ef7726f66b8
changes/73/19173/1
Richard Fuchs 7 years ago
parent 7c36492021
commit 4d586f2ec0

@ -114,9 +114,9 @@ static void __make_transcoder(struct codec_handler *handler, struct rtp_payload_
if (handler->func != handler_func_transcode) if (handler->func != handler_func_transcode)
goto reset; goto reset;
ilog(LOG_DEBUG, "Leaving transcode context for " STR_FORMAT "/%i -> " STR_FORMAT "/%i intact", ilog(LOG_DEBUG, "Leaving transcode context for " STR_FORMAT " -> " STR_FORMAT " intact",
STR_FMT(&source->encoding_with_params), source->channels, STR_FMT(&source->encoding_with_params),
STR_FMT(&dest->encoding_with_params), dest->channels); STR_FMT(&dest->encoding_with_params));
return; return;
@ -130,9 +130,9 @@ reset:
handler->ssrc_hash = create_ssrc_hash_full(__ssrc_handler_new, (ssrc_free_func_t) __ssrc_handler_free, handler->ssrc_hash = create_ssrc_hash_full(__ssrc_handler_new, (ssrc_free_func_t) __ssrc_handler_free,
handler); handler);
ilog(LOG_DEBUG, "Created transcode context for " STR_FORMAT "/%i -> " STR_FORMAT "/%i", ilog(LOG_DEBUG, "Created transcode context for " STR_FORMAT " -> " STR_FORMAT "",
STR_FMT(&source->encoding_with_params), source->channels, STR_FMT(&source->encoding_with_params),
STR_FMT(&dest->encoding_with_params), dest->channels); STR_FMT(&dest->encoding_with_params));
} }
static void __ensure_codec_def(struct rtp_payload_type *pt, struct call_media *media) { static void __ensure_codec_def(struct rtp_payload_type *pt, struct call_media *media) {

@ -20,6 +20,12 @@ AVFrame *resample_frame(resample_t *resample, AVFrame *frame, const format_t *to
int errcode = 0; int errcode = 0;
uint64_t to_channel_layout = av_get_default_channel_layout(to_format->channels); uint64_t to_channel_layout = av_get_default_channel_layout(to_format->channels);
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54, 31, 0)
if (!frame->channel_layout)
frame->channel_layout = av_get_default_channel_layout(
av_frame_get_channels(frame));
#endif
if (frame->format != to_format->format) if (frame->format != to_format->format)
goto resample; goto resample;
if (frame->sample_rate != to_format->clockrate) if (frame->sample_rate != to_format->clockrate)
@ -37,12 +43,6 @@ resample:
if (!resample->avresample) if (!resample->avresample)
goto err; goto err;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54, 31, 0)
if (!frame->channel_layout)
frame->channel_layout = av_get_default_channel_layout(
av_frame_get_channels(frame));
#endif
err = "failed to set resample option"; err = "failed to set resample option";
if ((errcode = av_opt_set_int(resample->avresample, "in_channel_layout", if ((errcode = av_opt_set_int(resample->avresample, "in_channel_layout",
frame->channel_layout, 0))) frame->channel_layout, 0)))

@ -62,6 +62,9 @@ decoder_t *decoder_new(const char *payload_str, output_t *outp) {
out_format.clockrate = resample_audio; out_format.clockrate = resample_audio;
// mono/stereo mixing goes here: out_format.channels = ... // mono/stereo mixing goes here: out_format.channels = ...
if (outp) { if (outp) {
// if this output has been configured already, re-use the same format
if (outp->encoder && outp->encoder->requested_format.format != -1)
out_format = outp->encoder->requested_format;
output_config(outp, &out_format, &out_format); output_config(outp, &out_format, &out_format);
// save the returned sample format so we don't output_config() twice // save the returned sample format so we don't output_config() twice
outp->encoder->requested_format.format = out_format.format; outp->encoder->requested_format.format = out_format.format;

Loading…
Cancel
Save