Reland "Remove our stream << overloads from non-test build targets."
This is a reland of c841d18d257ba8e4ed7d77d105e3c46006bb1e7e Original change's description: > Remove our stream << overloads from non-test build targets. > > Most are removed entirely, but RtcErrorType, RtpTransceiverDirection, IPAddress and > SocketAddress are kept behind gtest's #ifdef UNIT_TEST. > > Bug: webrtc:8982 > Change-Id: I36db19891e7d25aeacb08b9a08aa2b4004765e70 > Reviewed-on: https://webrtc-review.googlesource.com/64143 > Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org> > Reviewed-by: Benjamin Wright <benwright@webrtc.org> > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > Reviewed-by: Åsa Persson <asapersson@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22916} TBR=deadbeef@webrtc.org,kwiberg@webrtc.org,asapersson@webrtc.org,jonasolsson@webrtc.org,benwright@webrtc.org Bug: webrtc:8982 Change-Id: Ibe08c6270e5e693eb661a6ce9e8f074b34ef8123 Reviewed-on: https://webrtc-review.googlesource.com/71161 Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org> Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22949}
This commit is contained in:
@ -68,20 +68,6 @@ void swap(SdpAudioFormat& a, SdpAudioFormat& b) {
|
|||||||
swap(a.parameters, b.parameters);
|
swap(a.parameters, b.parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const SdpAudioFormat& saf) {
|
|
||||||
os << "{name: " << saf.name;
|
|
||||||
os << ", clockrate_hz: " << saf.clockrate_hz;
|
|
||||||
os << ", num_channels: " << saf.num_channels;
|
|
||||||
os << ", parameters: {";
|
|
||||||
const char* sep = "";
|
|
||||||
for (const auto& kv : saf.parameters) {
|
|
||||||
os << sep << kv.first << ": " << kv.second;
|
|
||||||
sep = ", ";
|
|
||||||
}
|
|
||||||
os << "}}";
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioCodecInfo::AudioCodecInfo(int sample_rate_hz,
|
AudioCodecInfo::AudioCodecInfo(int sample_rate_hz,
|
||||||
size_t num_channels,
|
size_t num_channels,
|
||||||
int bitrate_bps)
|
int bitrate_bps)
|
||||||
@ -108,23 +94,4 @@ AudioCodecInfo::AudioCodecInfo(int sample_rate_hz,
|
|||||||
RTC_DCHECK_GE(max_bitrate_bps, default_bitrate_bps);
|
RTC_DCHECK_GE(max_bitrate_bps, default_bitrate_bps);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const AudioCodecInfo& aci) {
|
|
||||||
os << "{sample_rate_hz: " << aci.sample_rate_hz;
|
|
||||||
os << ", num_channels: " << aci.num_channels;
|
|
||||||
os << ", default_bitrate_bps: " << aci.default_bitrate_bps;
|
|
||||||
os << ", min_bitrate_bps: " << aci.min_bitrate_bps;
|
|
||||||
os << ", max_bitrate_bps: " << aci.max_bitrate_bps;
|
|
||||||
os << ", allow_comfort_noise: " << aci.allow_comfort_noise;
|
|
||||||
os << ", supports_network_adaption: " << aci.supports_network_adaption;
|
|
||||||
os << "}";
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const AudioCodecSpec& acs) {
|
|
||||||
os << "{format: " << acs.format;
|
|
||||||
os << ", info: " << acs.info;
|
|
||||||
os << "}";
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#define API_AUDIO_CODECS_AUDIO_FORMAT_H_
|
#define API_AUDIO_CODECS_AUDIO_FORMAT_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -62,7 +61,6 @@ struct SdpAudioFormat {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void swap(SdpAudioFormat& a, SdpAudioFormat& b);
|
void swap(SdpAudioFormat& a, SdpAudioFormat& b);
|
||||||
std::ostream& operator<<(std::ostream& os, const SdpAudioFormat& saf);
|
|
||||||
|
|
||||||
// Information about how an audio format is treated by the codec implementation.
|
// Information about how an audio format is treated by the codec implementation.
|
||||||
// Contains basic information, such as sample rate and number of channels, which
|
// Contains basic information, such as sample rate and number of channels, which
|
||||||
@ -121,8 +119,6 @@ struct AudioCodecInfo {
|
|||||||
// network conditions.
|
// network conditions.
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const AudioCodecInfo& aci);
|
|
||||||
|
|
||||||
// AudioCodecSpec ties an audio format to specific information about the codec
|
// AudioCodecSpec ties an audio format to specific information about the codec
|
||||||
// and its implementation.
|
// and its implementation.
|
||||||
struct AudioCodecSpec {
|
struct AudioCodecSpec {
|
||||||
@ -136,8 +132,6 @@ struct AudioCodecSpec {
|
|||||||
AudioCodecInfo info;
|
AudioCodecInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const AudioCodecSpec& acs);
|
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // API_AUDIO_CODECS_AUDIO_FORMAT_H_
|
#endif // API_AUDIO_CODECS_AUDIO_FORMAT_H_
|
||||||
|
@ -93,10 +93,6 @@ void RTCError::set_message(std::string&& message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, RTCErrorType error) {
|
|
||||||
return stream << ToString(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(jonasolsson): Change to use absl::string_view when it's available.
|
// TODO(jonasolsson): Change to use absl::string_view when it's available.
|
||||||
std::string ToString(RTCErrorType error) {
|
std::string ToString(RTCErrorType error) {
|
||||||
int index = static_cast<int>(error);
|
int index = static_cast<int>(error);
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#ifndef API_RTCERROR_H_
|
#ifndef API_RTCERROR_H_
|
||||||
#define API_RTCERROR_H_
|
#define API_RTCERROR_H_
|
||||||
|
|
||||||
|
#ifdef UNIT_TEST
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#endif // UNIT_TEST
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility> // For std::move.
|
#include <utility> // For std::move.
|
||||||
|
|
||||||
@ -143,10 +145,16 @@ class RTCError {
|
|||||||
// error type.
|
// error type.
|
||||||
//
|
//
|
||||||
// Only intended to be used for logging/disagnostics.
|
// Only intended to be used for logging/disagnostics.
|
||||||
std::ostream& operator<<(std::ostream& stream, RTCErrorType error);
|
|
||||||
|
|
||||||
std::string ToString(RTCErrorType error);
|
std::string ToString(RTCErrorType error);
|
||||||
|
|
||||||
|
#ifdef UNIT_TEST
|
||||||
|
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
std::ostream& stream, // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
RTCErrorType error) {
|
||||||
|
return stream << ToString(error);
|
||||||
|
}
|
||||||
|
#endif // UNIT_TEST
|
||||||
|
|
||||||
// Helper macro that can be used by implementations to create an error with a
|
// Helper macro that can be used by implementations to create an error with a
|
||||||
// message and log it. |message| should be a string literal or movable
|
// message and log it. |message| should be a string literal or movable
|
||||||
// std::string.
|
// std::string.
|
||||||
|
@ -30,9 +30,6 @@ enum class RtpTransceiverDirection {
|
|||||||
kInactive
|
kInactive
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is provided as a debugging aid. The format of the output is unspecified.
|
|
||||||
std::ostream& operator<<(std::ostream& os, RtpTransceiverDirection direction);
|
|
||||||
|
|
||||||
// Structure for initializing an RtpTransceiver in a call to
|
// Structure for initializing an RtpTransceiver in a call to
|
||||||
// PeerConnectionInterface::AddTransceiver.
|
// PeerConnectionInterface::AddTransceiver.
|
||||||
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
|
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
|
||||||
|
@ -223,16 +223,6 @@ struct CodecInst {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const CodecInst& other) const { return !(*this == other); }
|
bool operator!=(const CodecInst& other) const { return !(*this == other); }
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& os, const CodecInst& ci) {
|
|
||||||
os << "{pltype: " << ci.pltype;
|
|
||||||
os << ", plname: " << ci.plname;
|
|
||||||
os << ", plfreq: " << ci.plfreq;
|
|
||||||
os << ", pacsize: " << ci.pacsize;
|
|
||||||
os << ", channels: " << ci.channels;
|
|
||||||
os << ", rate: " << ci.rate << "}";
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// RTP
|
// RTP
|
||||||
|
@ -149,28 +149,6 @@ struct AudioCodec : public Codec {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream& operator<<(std::ostream& os, const AudioCodec& ac) {
|
|
||||||
os << "{id: " << ac.id;
|
|
||||||
os << ", name: " << ac.name;
|
|
||||||
os << ", clockrate: " << ac.clockrate;
|
|
||||||
os << ", bitrate: " << ac.bitrate;
|
|
||||||
os << ", channels: " << ac.channels;
|
|
||||||
os << ", params: {";
|
|
||||||
const char* sep = "";
|
|
||||||
for (const auto& kv : ac.params) {
|
|
||||||
os << sep << kv.first << ": " << kv.second;
|
|
||||||
sep = ", ";
|
|
||||||
}
|
|
||||||
os << "}, feedback_params: {";
|
|
||||||
sep = "";
|
|
||||||
for (const FeedbackParam& fp : ac.feedback_params.params()) {
|
|
||||||
os << sep << fp.id() << ": " << fp.param();
|
|
||||||
sep = ", ";
|
|
||||||
}
|
|
||||||
os << "}}";
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct VideoCodec : public Codec {
|
struct VideoCodec : public Codec {
|
||||||
// Creates a codec with the given parameters.
|
// Creates a codec with the given parameters.
|
||||||
VideoCodec(int id, const std::string& name);
|
VideoCodec(int id, const std::string& name);
|
||||||
|
@ -53,11 +53,6 @@ inline std::string ToString(H264PacketizationMode mode) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream& operator<<(std::ostream& stream,
|
|
||||||
H264PacketizationMode mode) {
|
|
||||||
return stream << ToString(mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct NaluInfo {
|
struct NaluInfo {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
int sps_id;
|
int sps_id;
|
||||||
|
@ -44,6 +44,14 @@ RtpTransceiverDirection RtpTransceiverDirectionWithRecvSet(
|
|||||||
// Returns an unspecified string representation of the given direction.
|
// Returns an unspecified string representation of the given direction.
|
||||||
const char* RtpTransceiverDirectionToString(RtpTransceiverDirection direction);
|
const char* RtpTransceiverDirectionToString(RtpTransceiverDirection direction);
|
||||||
|
|
||||||
|
#ifdef UNIT_TEST
|
||||||
|
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
RtpTransceiverDirection direction) {
|
||||||
|
return os << RtpTransceiverDirectionToString(direction);
|
||||||
|
}
|
||||||
|
#endif // UNIT_TEST
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // PC_RTPMEDIAUTILS_H_
|
#endif // PC_RTPMEDIAUTILS_H_
|
||||||
|
@ -16,10 +16,6 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, RtpTransceiverDirection direction) {
|
|
||||||
return os << RtpTransceiverDirectionToString(direction);
|
|
||||||
}
|
|
||||||
|
|
||||||
RtpTransceiver::RtpTransceiver(cricket::MediaType media_type)
|
RtpTransceiver::RtpTransceiver(cricket::MediaType media_type)
|
||||||
: unified_plan_(false), media_type_(media_type) {
|
: unified_plan_(false), media_type_(media_type) {
|
||||||
RTC_DCHECK(media_type == cricket::MEDIA_TYPE_AUDIO ||
|
RTC_DCHECK(media_type == cricket::MEDIA_TYPE_AUDIO ||
|
||||||
|
@ -120,11 +120,6 @@ bool IPAddress::operator <(const IPAddress &other) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const IPAddress& ip) {
|
|
||||||
os << ip.ToString();
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
in6_addr IPAddress::ipv6_address() const {
|
in6_addr IPAddress::ipv6_address() const {
|
||||||
return u_.ip6;
|
return u_.ip6;
|
||||||
}
|
}
|
||||||
@ -216,10 +211,6 @@ const InterfaceAddress& InterfaceAddress::operator=(
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const InterfaceAddress& ip) {
|
|
||||||
return os << ip.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string InterfaceAddress::ToString() const {
|
std::string InterfaceAddress::ToString() const {
|
||||||
std::string result = IPAddress::ToString();
|
std::string result = IPAddress::ToString();
|
||||||
|
|
||||||
|
@ -83,7 +83,13 @@ class IPAddress {
|
|||||||
bool operator!=(const IPAddress& other) const;
|
bool operator!=(const IPAddress& other) const;
|
||||||
bool operator <(const IPAddress& other) const;
|
bool operator <(const IPAddress& other) const;
|
||||||
bool operator >(const IPAddress& other) const;
|
bool operator >(const IPAddress& other) const;
|
||||||
friend std::ostream& operator<<(std::ostream& os, const IPAddress& addr);
|
|
||||||
|
#ifdef UNIT_TEST
|
||||||
|
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
std::ostream& os) { // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
return os << ToString();
|
||||||
|
}
|
||||||
|
#endif // UNIT_TEST
|
||||||
|
|
||||||
int family() const { return family_; }
|
int family() const { return family_; }
|
||||||
in_addr ipv4_address() const;
|
in_addr ipv4_address() const;
|
||||||
@ -141,8 +147,6 @@ class InterfaceAddress : public IPAddress {
|
|||||||
bool operator!=(const InterfaceAddress& other) const;
|
bool operator!=(const InterfaceAddress& other) const;
|
||||||
|
|
||||||
int ipv6_flags() const { return ipv6_flags_; }
|
int ipv6_flags() const { return ipv6_flags_; }
|
||||||
friend std::ostream& operator<<(std::ostream& os,
|
|
||||||
const InterfaceAddress& addr);
|
|
||||||
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
|
@ -199,11 +199,6 @@ bool SocketAddress::FromString(const std::string& str) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const SocketAddress& addr) {
|
|
||||||
os << addr.HostAsURIString() << ":" << addr.port();
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SocketAddress::IsAnyIP() const {
|
bool SocketAddress::IsAnyIP() const {
|
||||||
return IPIsAny(ip_);
|
return IPIsAny(ip_);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#ifdef UNIT_TEST
|
||||||
|
#include <ostream> // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
#endif // UNIT_TEST
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "rtc_base/basictypes.h"
|
#include "rtc_base/basictypes.h"
|
||||||
#include "rtc_base/ipaddress.h"
|
#include "rtc_base/ipaddress.h"
|
||||||
@ -126,7 +129,12 @@ class SocketAddress {
|
|||||||
// Parses hostname:port and [hostname]:port.
|
// Parses hostname:port and [hostname]:port.
|
||||||
bool FromString(const std::string& str);
|
bool FromString(const std::string& str);
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& os, const SocketAddress& addr);
|
#ifdef UNIT_TEST
|
||||||
|
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
std::ostream& os) { // no-presubmit-check TODO(webrtc:8982)
|
||||||
|
return os << HostAsURIString() << ":" << port();
|
||||||
|
}
|
||||||
|
#endif // UNIT_TEST
|
||||||
|
|
||||||
// Determines whether this represents a missing / any IP address.
|
// Determines whether this represents a missing / any IP address.
|
||||||
// That is, 0.0.0.0 or ::.
|
// That is, 0.0.0.0 or ::.
|
||||||
|
Reference in New Issue
Block a user