Skip to content

Commit e42802f

Browse files
author
Clement Champetier
committed
InputAudio: check subStream in readNextFrame
If the subStream doesn't exist, raise an exception.
1 parent ce9dacf commit e42802f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/AvTranscoder/EssenceStream/InputAudio.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ bool InputAudio::readNextFrame( Frame& frameBuffer, const size_t subStreamIndex
146146
size_t nbChannels = _codecContext->channels;
147147
size_t bytePerSample = av_get_bytes_per_sample( (AVSampleFormat)_frame->format );
148148

149+
if( subStreamIndex > nbChannels - 1 )
150+
{
151+
throw std::runtime_error( "The subStream doesn't exist");
152+
}
153+
149154
AudioFrame& audioBuffer = static_cast<AudioFrame&>( frameBuffer );
150155
audioBuffer.setNbSamples( _frame->nb_samples );
151156

0 commit comments

Comments
 (0)