Add NetEqInput::PacketData::ToString method

This new method prints information about the packet.

BUG=webrtc:7467

Review-Url: https://codereview.webrtc.org/2844283002
Cr-Original-Commit-Position: refs/heads/master@{#17922}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 7a38fd2628eb6711a9adae9ce93b41c85f1521b0
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 4c2602b..1867d93 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -1111,6 +1111,7 @@
     "neteq/tools/audio_sink.h",
     "neteq/tools/encode_neteq_input.cc",
     "neteq/tools/encode_neteq_input.h",
+    "neteq/tools/neteq_input.cc",
     "neteq/tools/neteq_input.h",
     "neteq/tools/neteq_test.cc",
     "neteq/tools/neteq_test.h",
diff --git a/modules/audio_coding/neteq/tools/neteq_input.cc b/modules/audio_coding/neteq/tools/neteq_input.cc
new file mode 100644
index 0000000..752bb29
--- /dev/null
+++ b/modules/audio_coding/neteq/tools/neteq_input.cc
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h"
+
+#include <sstream>
+
+namespace webrtc {
+namespace test {
+
+std::string NetEqInput::PacketData::ToString() const {
+  std::stringstream ss;
+  ss << "{"
+     << "time_ms: " << static_cast<int64_t>(time_ms) << ", "
+     << "header: {"
+     << "pt: " << static_cast<int>(header.payloadType) << ", "
+     << "sn: " << header.sequenceNumber << ", "
+     << "ts: " << header.timestamp << ", "
+     << "ssrc: " << header.ssrc << "}, "
+     << "payload bytes: " << payload.size() << "}";
+  return ss.str();
+}
+
+}  // namespace test
+}  // namespace webrtc
diff --git a/modules/audio_coding/neteq/tools/neteq_input.h b/modules/audio_coding/neteq/tools/neteq_input.h
index 3bb64a6..a1e51a3 100644
--- a/modules/audio_coding/neteq/tools/neteq_input.h
+++ b/modules/audio_coding/neteq/tools/neteq_input.h
@@ -13,6 +13,7 @@
 
 #include <algorithm>
 #include <memory>
+#include <string>
 
 #include "webrtc/base/buffer.h"
 #include "webrtc/base/optional.h"
@@ -27,6 +28,8 @@
 class NetEqInput {
  public:
   struct PacketData {
+    std::string ToString() const;
+
     RTPHeader header;
     rtc::Buffer payload;
     double time_ms;
diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc
index fb00025..7cca0fe 100644
--- a/modules/audio_coding/neteq/tools/neteq_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_test.cc
@@ -26,12 +26,8 @@
               << std::endl;
   } else {
     std::cerr << "InsertPacket returned error code " << error_code << std::endl;
-    std::cerr << "Header data:" << std::endl;
-    std::cerr << "  PT = " << static_cast<int>(packet.header.payloadType)
-              << std::endl;
-    std::cerr << "  SN = " << packet.header.sequenceNumber << std::endl;
-    std::cerr << "  TS = " << packet.header.timestamp << std::endl;
   }
+  std::cerr << "Packet data: " << packet.ToString() << std::endl;
   FATAL();
 }