Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: webrtc/media/base/codec.h

Issue 2705203002: Implement operator<< for AudioCodec (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/media/base/codec_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 AudioCodec& operator=(const AudioCodec& c); 137 AudioCodec& operator=(const AudioCodec& c);
138 AudioCodec& operator=(AudioCodec&& c); 138 AudioCodec& operator=(AudioCodec&& c);
139 139
140 bool operator==(const AudioCodec& c) const; 140 bool operator==(const AudioCodec& c) const;
141 141
142 bool operator!=(const AudioCodec& c) const { 142 bool operator!=(const AudioCodec& c) const {
143 return !(*this == c); 143 return !(*this == c);
144 } 144 }
145 }; 145 };
146 146
147 inline std::ostream& operator<<(std::ostream& os, const AudioCodec& ac) {
148 os << "{id: " << ac.id;
149 os << ", name: " << ac.name;
150 os << ", clockrate: " << ac.clockrate;
151 os << ", bitrate: " << ac.bitrate;
152 os << ", channels: " << ac.channels;
153 os << ", params: {";
154 const char* sep = "";
155 for (const auto& kv : ac.params) {
156 os << sep << kv.first << ": " << kv.second;
157 sep = ", ";
158 }
159 os << "}, feedback_params: {";
160 sep = "";
161 for (const FeedbackParam& fp : ac.feedback_params.params()) {
162 os << sep << fp.id() << ": " << fp.param();
163 sep = ", ";
164 }
165 os << "}}";
166 return os;
167 }
168
147 struct VideoCodec : public Codec { 169 struct VideoCodec : public Codec {
148 // Creates a codec with the given parameters. 170 // Creates a codec with the given parameters.
149 VideoCodec(int id, const std::string& name); 171 VideoCodec(int id, const std::string& name);
150 // Creates a codec with the given name and empty id. 172 // Creates a codec with the given name and empty id.
151 explicit VideoCodec(const std::string& name); 173 explicit VideoCodec(const std::string& name);
152 // Creates an empty codec. 174 // Creates an empty codec.
153 VideoCodec(); 175 VideoCodec();
154 VideoCodec(const VideoCodec& c); 176 VideoCodec(const VideoCodec& c);
155 VideoCodec(VideoCodec&& c); 177 VideoCodec(VideoCodec&& c);
156 virtual ~VideoCodec() = default; 178 virtual ~VideoCodec() = default;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool HasTransportCc(const Codec& codec); 247 bool HasTransportCc(const Codec& codec);
226 // Returns the first codec in |supported_codecs| that matches |codec|, or 248 // Returns the first codec in |supported_codecs| that matches |codec|, or
227 // nullptr if no codec matches. 249 // nullptr if no codec matches.
228 const VideoCodec* FindMatchingCodec( 250 const VideoCodec* FindMatchingCodec(
229 const std::vector<VideoCodec>& supported_codecs, 251 const std::vector<VideoCodec>& supported_codecs,
230 const VideoCodec& codec); 252 const VideoCodec& codec);
231 253
232 } // namespace cricket 254 } // namespace cricket
233 255
234 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ 256 #endif // WEBRTC_MEDIA_BASE_CODEC_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/base/codec_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698