From: Helge Norberg Date: Thu, 10 Nov 2016 16:33:15 +0000 (+0100) Subject: [ffmpeg] Classify most ffmpeg errors as user errors, so we don't get a stacktrace... X-Git-Tag: 2.1.0_Beta1~13 X-Git-Url: https://git.sesse.net/?p=casparcg;a=commitdiff_plain;h=ae40f3d47bad19078bf9f4f47057e623ad8a945f [ffmpeg] Classify most ffmpeg errors as user errors, so we don't get a stacktrace every time an invalid parameter has been given to ffmpeg via AMCP --- diff --git a/modules/ffmpeg/ffmpeg_error.cpp b/modules/ffmpeg/ffmpeg_error.cpp index 94100dea0..a69583f17 100644 --- a/modules/ffmpeg/ffmpeg_error.cpp +++ b/modules/ffmpeg/ffmpeg_error.cpp @@ -169,6 +169,16 @@ void throw_on_ffmpeg_error(int ret, const char* source, const char* func, const << call_stack_info(caspar::get_call_stack()) << context_info(get_context()), local_func, file, line); + case AVUNERROR(EINVAL): + ::boost::exception_detail::throw_exception_( + averror_invalid_argument() + << msg_info("Invalid FFmpeg argument given") + << source_info(source) + << boost::errinfo_api_function(func) + << boost::errinfo_errno(AVUNERROR(ret)) + << call_stack_info(caspar::get_call_stack()) + << context_info(get_context()), + local_func, file, line); default: ::boost::exception_detail::throw_exception_( ffmpeg_error() diff --git a/modules/ffmpeg/ffmpeg_error.h b/modules/ffmpeg/ffmpeg_error.h index b615631cb..0c70667b1 100644 --- a/modules/ffmpeg/ffmpeg_error.h +++ b/modules/ffmpeg/ffmpeg_error.h @@ -28,18 +28,20 @@ namespace caspar { namespace ffmpeg { struct ffmpeg_error : virtual caspar_exception{}; +struct ffmpeg_user_error : virtual user_error {}; struct averror_bsf_not_found : virtual ffmpeg_error{}; -struct averror_decoder_not_found : virtual ffmpeg_error{}; -struct averror_demuxer_not_found : virtual ffmpeg_error{}; -struct averror_encoder_not_found : virtual ffmpeg_error{}; +struct averror_decoder_not_found : virtual ffmpeg_user_error {}; +struct averror_demuxer_not_found : virtual ffmpeg_user_error {}; +struct averror_encoder_not_found : virtual ffmpeg_user_error {}; struct averror_eof : virtual ffmpeg_error{}; struct averror_exit : virtual ffmpeg_error{}; -struct averror_filter_not_found : virtual ffmpeg_error{}; -struct averror_muxer_not_found : virtual ffmpeg_error{}; -struct averror_option_not_found : virtual ffmpeg_error{}; +struct averror_filter_not_found : virtual ffmpeg_user_error {}; +struct averror_muxer_not_found : virtual ffmpeg_user_error {}; +struct averror_option_not_found : virtual ffmpeg_user_error {}; struct averror_patchwelcome : virtual ffmpeg_error{}; -struct averror_protocol_not_found : virtual ffmpeg_error{}; +struct averror_protocol_not_found : virtual ffmpeg_user_error {}; struct averror_stream_not_found : virtual ffmpeg_error{}; +struct averror_invalid_argument : virtual ffmpeg_user_error {}; std::string av_error_str(int errn); @@ -53,7 +55,7 @@ void throw_on_ffmpeg_error(int ret, const std::wstring& source, const char* func #define THROW_ON_ERROR_STR(call) THROW_ON_ERROR_STR_(call) #define THROW_ON_ERROR(ret, func, source) \ - throw_on_ffmpeg_error(ret, source, func, __FUNCTION__, __FILE__, __LINE__); + throw_on_ffmpeg_error(ret, source, func, __FUNCTION__, __FILE__, __LINE__); #define THROW_ON_ERROR2(call, source) \ [&]() -> int \ @@ -76,7 +78,7 @@ void throw_on_ffmpeg_error(int ret, const std::wstring& source, const char* func }() #define FF_RET(ret, func) \ - caspar::ffmpeg::throw_on_ffmpeg_error(ret, L"", func, __FUNCTION__, __FILE__, __LINE__); + caspar::ffmpeg::throw_on_ffmpeg_error(ret, L"", func, __FUNCTION__, __FILE__, __LINE__); #define FF(call) \ [&]() -> int \