NetEq: Add codec name and RTP timestamp rate to DecoderInfo

The new fields are default-populated for built-in decoders, but for
external decoders, the name can now be given when registering the
decoder.

BUG=webrtc:3520

Review URL: https://codereview.webrtc.org/1484343003

Cr-Commit-Position: refs/heads/master@{#10952}
diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.h b/webrtc/modules/audio_coding/neteq/decoder_database.h
index ea70997..f34904f 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.h
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.h
@@ -12,8 +12,10 @@
 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
 
 #include <map>
+#include <string>
 
 #include "webrtc/base/constructormagic.h"
+#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_types.h"  // NULL
 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
 #include "webrtc/modules/audio_coding/neteq/packet.h"
@@ -35,25 +37,28 @@
 
   // Struct used to store decoder info in the database.
   struct DecoderInfo {
-    // Constructors.
-    DecoderInfo()
-        : codec_type(NetEqDecoder::kDecoderArbitrary),
-          fs_hz(8000),
-          decoder(NULL),
-          external(false) {}
+    DecoderInfo() = default;
     DecoderInfo(NetEqDecoder ct, int fs, AudioDecoder* dec, bool ext)
+        : DecoderInfo(ct, "", fs, dec, ext) {}
+    DecoderInfo(NetEqDecoder ct,
+                const std::string& nm,
+                int fs,
+                AudioDecoder* dec,
+                bool ext)
         : codec_type(ct),
+          name(nm),
           fs_hz(fs),
+          rtp_sample_rate_hz(fs),
           decoder(dec),
-          external(ext) {
-    }
-    // Destructor. (Defined in decoder_database.cc.)
+          external(ext) {}
     ~DecoderInfo();
 
-    NetEqDecoder codec_type;
-    int fs_hz;
-    AudioDecoder* decoder;
-    bool external;
+    NetEqDecoder codec_type = NetEqDecoder::kDecoderArbitrary;
+    std::string name;
+    int fs_hz = 8000;
+    int rtp_sample_rate_hz = 8000;
+    AudioDecoder* decoder = nullptr;
+    bool external = false;
   };
 
   // Maximum value for 8 bits, and an invalid RTP payload type (since it is
@@ -75,16 +80,21 @@
   // using InsertExternal().
   virtual void Reset();
 
-  // Registers |rtp_payload_type| as a decoder of type |codec_type|. Returns
-  // kOK on success; otherwise an error code.
+  // Registers |rtp_payload_type| as a decoder of type |codec_type|. The |name|
+  // is only used to populate the name field in the DecoderInfo struct in the
+  // database, and can be arbitrary (including empty). Returns kOK on success;
+  // otherwise an error code.
   virtual int RegisterPayload(uint8_t rtp_payload_type,
-                              NetEqDecoder codec_type);
+                              NetEqDecoder codec_type,
+                              const std::string& name);
 
   // Registers an externally created AudioDecoder object, and associates it
   // as a decoder of type |codec_type| with |rtp_payload_type|.
   virtual int InsertExternal(uint8_t rtp_payload_type,
                              NetEqDecoder codec_type,
-                             int fs_hz, AudioDecoder* decoder);
+                             const std::string& codec_name,
+                             int fs_hz,
+                             AudioDecoder* decoder);
 
   // Removes the entry for |rtp_payload_type| from the database.
   // Returns kDecoderNotFound or kOK depending on the outcome of the operation.