Skip to content

Commit d871b7f

Browse files
committed
fixed an issue with audio formats that have no channel layout specified - now taking the default layout
1 parent bea14c4 commit d871b7f

File tree

1 file changed

+3
-1
lines changed
  • source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks

1 file changed

+3
-1
lines changed

source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/Filter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,12 @@ namespace ffmpegcpp
147147
// this is an audio input stream
148148
else if (metaData->type == AVMEDIA_TYPE_AUDIO)
149149
{
150+
uint64_t channelLayout = frame->channel_layout;
151+
if (channelLayout == 0) channelLayout = av_get_default_channel_layout(frame->channels);
150152
snprintf(args, argsLength,
151153
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%d",
152154
metaData->timeBase.num, metaData->timeBase.den, frame->sample_rate,
153-
av_get_sample_fmt_name((AVSampleFormat)frame->format), frame->channel_layout);
155+
av_get_sample_fmt_name((AVSampleFormat)frame->format), channelLayout);
154156
}
155157

156158
// not supported

0 commit comments

Comments
 (0)