Skip to content

Commit 8642c80

Browse files
author
Clement Champetier
committed
AudioTransform: added log to get the channel layout info
1 parent 21506ac commit 8642c80

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/AvTranscoder/transform/AudioTransform.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bool AudioTransform::init(const Frame& srcFrame, const Frame& dstFrame)
5555
const AudioFrame& src = static_cast<const AudioFrame&>(srcFrame);
5656
const AudioFrame& dst = static_cast<const AudioFrame&>(dstFrame);
5757

58-
av_opt_set_int(_audioConvertContext, "in_channel_layout", av_get_default_channel_layout(src.getNbChannels()), 0);
59-
av_opt_set_int(_audioConvertContext, "out_channel_layout", av_get_default_channel_layout(dst.getNbChannels()), 0);
58+
av_opt_set_int(_audioConvertContext, "in_channel_layout", src.getChannelLayout(), 0);
59+
av_opt_set_int(_audioConvertContext, "out_channel_layout", dst.getChannelLayout(), 0);
6060
av_opt_set_int(_audioConvertContext, "in_sample_rate", src.getSampleRate(), 0);
6161
av_opt_set_int(_audioConvertContext, "out_sample_rate", dst.getSampleRate(), 0);
6262
SetSampleFormat(_audioConvertContext, "in_sample_fmt", src.getSampleFormat(), 0);
@@ -67,8 +67,8 @@ bool AudioTransform::init(const Frame& srcFrame, const Frame& dstFrame)
6767
FreeResampleContext(&_audioConvertContext);
6868
std::stringstream msg;
6969
msg << "Unable to open audio convert context:" << std::endl;
70-
msg << "in_channel_layout " << av_get_default_channel_layout(src.getNbChannels()) << std::endl;
71-
msg << "out_channel_layout " << av_get_default_channel_layout(dst.getNbChannels()) << std::endl;
70+
msg << "in_channel_layout " << src.getChannelLayoutDesc() << std::endl;
71+
msg << "out_channel_layout " << dst.getChannelLayoutDesc() << std::endl;
7272
msg << "in_sample_rate " << src.getSampleRate() << std::endl;
7373
msg << "out_sample_rate " << dst.getSampleRate() << std::endl;
7474
msg << "in_sample_fmt " << src.getSampleFormat() << std::endl;
@@ -80,8 +80,10 @@ bool AudioTransform::init(const Frame& srcFrame, const Frame& dstFrame)
8080
msg << "Audio conversion from " << getSampleFormatName(src.getSampleFormat()) << " to "
8181
<< getSampleFormatName(dst.getSampleFormat()) << std::endl;
8282
msg << "Source, number of channels = " << src.getNbChannels() << std::endl;
83+
msg << "Source, channel layout = " << src.getChannelLayoutDesc() << std::endl;
8384
msg << "Source, sample rate = " << src.getSampleRate() << std::endl;
8485
msg << "Destination, number of channels = " << dst.getNbChannels() << std::endl;
86+
msg << "Destination, channel layout = " << dst.getChannelLayoutDesc() << std::endl;
8587
msg << "Destination, sample rate = " << dst.getSampleRate() << std::endl;
8688
LOG_INFO(msg.str())
8789

0 commit comments

Comments
 (0)