Add ToString() methods to classes with << operators, preparing for deprecations.

Bug: webrtc:8982
Change-Id: I9b8792a229539dd9848f4d9936fe343f4bf9ad49
Reviewed-on: https://webrtc-review.googlesource.com/63200
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22705}
This commit is contained in:
Jonas Olsson
2018-04-03 12:22:07 +02:00
committed by Commit Bot
parent cf06a53152
commit 74395345e8
13 changed files with 147 additions and 27 deletions

View File

@ -14,6 +14,8 @@
#ifndef MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_GLOBALS_H_
#define MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_GLOBALS_H_
#include <string>
namespace webrtc {
// The packetization types that we support: single, aggregated, and fragmented.
@ -40,17 +42,20 @@ enum class H264PacketizationMode {
// This function is declared inline because it is not clear which
// .cc file it should belong to.
// TODO(hta): Refactor. https://bugs.webrtc.org/6842
// TODO(jonasolsson): Use absl::string_view instead when that's available.
inline std::string ToString(H264PacketizationMode mode) {
if (mode == H264PacketizationMode::NonInterleaved) {
return "NonInterleaved";
} else if (mode == H264PacketizationMode::SingleNalUnit) {
return "SingleNalUnit";
}
RTC_NOTREACHED();
return "";
}
inline std::ostream& operator<<(std::ostream& stream,
H264PacketizationMode mode) {
switch (mode) {
case H264PacketizationMode::NonInterleaved:
stream << "NonInterleaved";
break;
case H264PacketizationMode::SingleNalUnit:
stream << "SingleNalUnit";
break;
}
return stream;
return stream << ToString(mode);
}
struct NaluInfo {