Skip to content

Commit decb49c

Browse files
author
Clement Champetier
committed
AudioTransform: improved ecxception message when cannot init audio context
1 parent ebe4cab commit decb49c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/AvTranscoder/transform/AudioTransform.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ bool AudioTransform::init( const Frame& srcFrame, const Frame& dstFrame )
6363
if( InitResampleContext( _audioConvertContext ) < 0 )
6464
{
6565
FreeResampleContext( &_audioConvertContext );
66-
throw std::runtime_error( "unable to open audio convert context" );
66+
std::stringstream msg;
67+
msg << "Unable to open audio convert context:" << std::endl;
68+
msg << "in_channel_layout " << av_get_default_channel_layout( src.desc().getChannels() ) << std::endl;
69+
msg << "out_channel_layout " << av_get_default_channel_layout( dst.desc().getChannels() ) << std::endl;
70+
msg << "in_sample_rate " << src.desc().getSampleRate() << std::endl;
71+
msg << "out_sample_rate " << dst.desc().getSampleRate() << std::endl;
72+
msg << "in_sample_fmt " << src.desc().getSampleFormat() << std::endl;
73+
msg << "out_sample_fmt " << dst.desc().getSampleFormat() << std::endl;
74+
throw std::runtime_error( msg.str() );
6775
}
6876

6977
return true;

0 commit comments

Comments
 (0)