Log decoder implementation name

Bug: none
Change-Id: I2c6b6a2a62bbcd058b8ed336e6e0f36b8b0d0844
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175220
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31321}
diff --git a/modules/video_coding/decoder_database.cc b/modules/video_coding/decoder_database.cc
index c203721..38a18ba 100644
--- a/modules/video_coding/decoder_database.cc
+++ b/modules/video_coding/decoder_database.cc
@@ -169,8 +169,10 @@
     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 ca9b5e2..cfe16ed 100644
--- a/modules/video_coding/generic_decoder.cc
+++ b/modules/video_coding/generic_decoder.cc
@@ -211,7 +211,10 @@
   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 @@
   _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 4b4d83e..40fe667 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 <memory>
+#include <string>
 
 #include "api/units/time_delta.h"
 #include "modules/video_coding/encoded_frame.h"
@@ -112,6 +113,7 @@
   VideoCodecType _codecType;
   const bool _isExternal;
   VideoContentType _last_keyframe_content_type;
+  std::string implementation_name_;
 };
 
 }  // namespace webrtc