Implement operator<< for AudioCodecInfo and AudioCodecSpec

I keep having to re-write these whenever I'm debugging.

BUG=webrtc:5806

Review-Url: https://codereview.webrtc.org/2936533003
Cr-Commit-Position: refs/heads/master@{#18586}
This commit is contained in:
kwiberg 2017-06-14 03:27:40 -07:00 committed by Commit Bot
parent 6c4ba9f77d
commit 96444aecfc
2 changed files with 23 additions and 0 deletions

View File

@ -108,4 +108,23 @@ AudioCodecInfo::AudioCodecInfo(int sample_rate_hz,
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

View File

@ -120,6 +120,8 @@ struct AudioCodecInfo {
// network conditions.
};
std::ostream& operator<<(std::ostream& os, const AudioCodecInfo& aci);
// AudioCodecSpec ties an audio format to specific information about the codec
// and its implementation.
struct AudioCodecSpec {
@ -133,6 +135,8 @@ struct AudioCodecSpec {
AudioCodecInfo info;
};
std::ostream& operator<<(std::ostream& os, const AudioCodecSpec& acs);
} // namespace webrtc
#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_FORMAT_H_