From 43c108b7e9a7436d43e0eb36f5898a432b4d840e Mon Sep 17 00:00:00 2001 From: Ilya Nikolaevskiy Date: Fri, 15 May 2020 12:24:29 +0200 Subject: [PATCH] Log decoder implementation name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: none Change-Id: I2c6b6a2a62bbcd058b8ed336e6e0f36b8b0d0844 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175220 Reviewed-by: Erik Språng Commit-Queue: Ilya Nikolaevskiy Cr-Commit-Position: refs/heads/master@{#31321} --- modules/video_coding/decoder_database.cc | 6 ++++-- modules/video_coding/generic_decoder.cc | 14 +++++++++++--- modules/video_coding/generic_decoder.h | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/video_coding/decoder_database.cc b/modules/video_coding/decoder_database.cc index c203721e5d..38a18baa6d 100644 --- a/modules/video_coding/decoder_database.cc +++ b/modules/video_coding/decoder_database.cc @@ -169,8 +169,10 @@ std::unique_ptr VCMDecoderDataBase::CreateAndInitDecoder( decoder_item->settings->width = frame.EncodedImage()._encodedWidth; decoder_item->settings->height = frame.EncodedImage()._encodedHeight; } - if (ptr_decoder->InitDecode(decoder_item->settings.get(), - decoder_item->number_of_cores) < 0) { + int err = ptr_decoder->InitDecode(decoder_item->settings.get(), + decoder_item->number_of_cores); + if (err < 0) { + RTC_LOG(LS_ERROR) << "Failed to initialize decoder. Error code: " << err; return nullptr; } memcpy(new_codec, decoder_item->settings.get(), sizeof(VideoCodec)); diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc index ca9b5e2d47..cfe16ed3f1 100644 --- a/modules/video_coding/generic_decoder.cc +++ b/modules/video_coding/generic_decoder.cc @@ -211,7 +211,10 @@ int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings, TRACE_EVENT0("webrtc", "VCMGenericDecoder::InitDecode"); _codecType = settings->codecType; - return decoder_->InitDecode(settings, numberOfCores); + int err = decoder_->InitDecode(settings, numberOfCores); + implementation_name_ = decoder_->ImplementationName(); + RTC_LOG(LS_INFO) << "Decoder implementation: " << implementation_name_; + return err; } int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) { @@ -239,8 +242,13 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) { _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength; int32_t ret = decoder_->Decode(frame.EncodedImage(), frame.MissingFrame(), frame.RenderTimeMs()); - - _callback->OnDecoderImplementationName(decoder_->ImplementationName()); + const char* new_implementation_name = decoder_->ImplementationName(); + if (new_implementation_name != implementation_name_) { + implementation_name_ = new_implementation_name; + RTC_LOG(LS_INFO) << "Changed decoder implementation to: " + << new_implementation_name; + } + _callback->OnDecoderImplementationName(implementation_name_.c_str()); if (ret < WEBRTC_VIDEO_CODEC_OK) { RTC_LOG(LS_WARNING) << "Failed to decode frame with timestamp " << frame.Timestamp() << ", error code: " << ret; diff --git a/modules/video_coding/generic_decoder.h b/modules/video_coding/generic_decoder.h index 4b4d83ecd5..40fe667d65 100644 --- a/modules/video_coding/generic_decoder.h +++ b/modules/video_coding/generic_decoder.h @@ -12,6 +12,7 @@ #define MODULES_VIDEO_CODING_GENERIC_DECODER_H_ #include +#include #include "api/units/time_delta.h" #include "modules/video_coding/encoded_frame.h" @@ -112,6 +113,7 @@ class VCMGenericDecoder { VideoCodecType _codecType; const bool _isExternal; VideoContentType _last_keyframe_content_type; + std::string implementation_name_; }; } // namespace webrtc