Add error reporting on VP8 encoder configuration error

Bug: webrtc:11310
Change-Id: I4ceb565b211a2313add193a3859f3baeaacc3e87
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182001
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31964}
This commit is contained in:
Florent Castelli
2020-08-19 12:33:26 +02:00
committed by Commit Bot
parent 7ad1011a19
commit eeedb6ea33
4 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -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<LibvpxInterface> CreateEncoder();
};

View File

@ -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]);
}
}
}

View File

@ -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