Skip to content

Commit 1cdebe6

Browse files
author
Clement Champetier
committed
InputStreamAudio: fix compile error with libAv
AVFrame has no "channels" attribute in LibAv. We should use "av_get_channel_layout_nb_channels" on the "channel_layouts".
1 parent b5c1db1 commit 1cdebe6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/AvTranscoder/InputStreamAudio.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ bool InputStreamAudio::readNextFrame( AudioFrame& audioFrameBuffer )
137137
if( audioFrameBuffer.getSize() != decodedSize )
138138
audioFrameBuffer.getBuffer().resize( decodedSize );
139139

140+
int nb_channels = av_get_channel_layout_nb_channels( *m_codecContext->codec->channel_layouts );
141+
140142
unsigned char* dest = audioFrameBuffer.getPtr();
141143
av_samples_fill_arrays(&dest, m_frame->linesize,
142144
m_frame->data[0],
143-
m_frame->channels, m_frame->nb_samples,
145+
nb_channels, m_frame->nb_samples,
144146
m_codecContext->sample_fmt, 1);
145147
}
146148

0 commit comments

Comments
 (0)