From eeedb6ea333772ade8032a182c9f82b59e58edd2 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 19 Aug 2020 12:33:26 +0200 Subject: [PATCH] Add error reporting on VP8 encoder configuration error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:11310 Change-Id: I4ceb565b211a2313add193a3859f3baeaacc3e87 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182001 Reviewed-by: Erik Språng Commit-Queue: Florent Castelli Cr-Commit-Position: refs/heads/master@{#31964} --- modules/video_coding/codecs/vp8/libvpx_interface.cc | 4 ++++ modules/video_coding/codecs/vp8/libvpx_interface.h | 2 ++ modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc | 4 +++- modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/video_coding/codecs/vp8/libvpx_interface.cc b/modules/video_coding/codecs/vp8/libvpx_interface.cc index 1a3df403ae..7bf6117157 100644 --- a/modules/video_coding/codecs/vp8/libvpx_interface.cc +++ b/modules/video_coding/codecs/vp8/libvpx_interface.cc @@ -195,6 +195,10 @@ class LibvpxVp8Facade : public LibvpxInterface { vpx_codec_iter_t* iter) const override { return ::vpx_codec_get_cx_data(ctx, iter); } + + const char* codec_error_detail(vpx_codec_ctx_t* ctx) const override { + return ::vpx_codec_error_detail(ctx); + } }; } // namespace diff --git a/modules/video_coding/codecs/vp8/libvpx_interface.h b/modules/video_coding/codecs/vp8/libvpx_interface.h index fe40dedeca..3da38ea24a 100644 --- a/modules/video_coding/codecs/vp8/libvpx_interface.h +++ b/modules/video_coding/codecs/vp8/libvpx_interface.h @@ -93,6 +93,8 @@ class LibvpxInterface { vpx_codec_ctx_t* ctx, vpx_codec_iter_t* iter) const = 0; + virtual const char* codec_error_detail(vpx_codec_ctx_t* ctx) const = 0; + // Returns interface wrapping the actual libvpx functions. static std::unique_ptr CreateEncoder(); }; diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc index f16eecd9dd..fdce11ab76 100644 --- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc +++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc @@ -419,7 +419,9 @@ void LibvpxVp8Encoder::SetRates(const RateControlParameters& parameters) { vpx_codec_err_t err = libvpx_->codec_enc_config_set(&encoders_[i], &vpx_configs_[i]); if (err != VPX_CODEC_OK) { - RTC_LOG(LS_WARNING) << "Error configuring codec, error code: " << err; + RTC_LOG(LS_WARNING) << "Error configuring codec, error code: " << err + << ", details: " + << libvpx_->codec_error_detail(&encoders_[i]); } } } diff --git a/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h b/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h index 1ac927d29f..697b44b9d5 100644 --- a/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h +++ b/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h @@ -99,6 +99,10 @@ class MockLibvpxVp8Interface : public LibvpxInterface { codec_get_cx_data, (vpx_codec_ctx_t*, vpx_codec_iter_t*), (const, override)); + MOCK_METHOD(const char*, + codec_error_detail, + (vpx_codec_ctx_t*), + (const, override)); }; } // namespace webrtc