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

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

Issue 1885473004: Adding codecs to the RtpParameters returned by an RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Responding to review comments. Created 4 years, 8 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
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 bool Codec::HasFeedbackParam(const FeedbackParam& param) const { 141 bool Codec::HasFeedbackParam(const FeedbackParam& param) const {
142 return feedback_params.Has(param); 142 return feedback_params.Has(param);
143 } 143 }
144 144
145 void Codec::IntersectFeedbackParams(const Codec& other) { 145 void Codec::IntersectFeedbackParams(const Codec& other) {
146 feedback_params.Intersect(other.feedback_params); 146 feedback_params.Intersect(other.feedback_params);
147 } 147 }
148 148
149 webrtc::RtpCodecParameters Codec::ToCodecParameters() const {
150 webrtc::RtpCodecParameters codec_params;
151 codec_params.payload_type = id;
152 codec_params.mime_type = name;
153 codec_params.clock_rate = clockrate;
154 return codec_params;
155 }
156
149 AudioCodec::AudioCodec(int id, 157 AudioCodec::AudioCodec(int id,
150 const std::string& name, 158 const std::string& name,
151 int clockrate, 159 int clockrate,
152 int bitrate, 160 int bitrate,
153 size_t channels, 161 size_t channels,
154 int preference) 162 int preference)
155 : Codec(id, name, clockrate, preference), 163 : Codec(id, name, clockrate, preference),
156 bitrate(bitrate), 164 bitrate(bitrate),
157 channels(channels) { 165 channels(channels) {
158 } 166 }
(...skipping 24 matching lines...) Expand all
183 // omitted if the number of channels is one." 191 // omitted if the number of channels is one."
184 // Preference is ignored. 192 // Preference is ignored.
185 // TODO(juberti): Treat a zero clockrate as 8000Hz, the RTP default clockrate. 193 // TODO(juberti): Treat a zero clockrate as 8000Hz, the RTP default clockrate.
186 return Codec::Matches(codec) && 194 return Codec::Matches(codec) &&
187 ((codec.clockrate == 0 /*&& clockrate == 8000*/) || 195 ((codec.clockrate == 0 /*&& clockrate == 8000*/) ||
188 clockrate == codec.clockrate) && 196 clockrate == codec.clockrate) &&
189 (codec.bitrate == 0 || bitrate <= 0 || bitrate == codec.bitrate) && 197 (codec.bitrate == 0 || bitrate <= 0 || bitrate == codec.bitrate) &&
190 ((codec.channels < 2 && channels < 2) || channels == codec.channels); 198 ((codec.channels < 2 && channels < 2) || channels == codec.channels);
191 } 199 }
192 200
201 webrtc::RtpCodecParameters AudioCodec::ToCodecParameters() const {
202 webrtc::RtpCodecParameters codec_params = Codec::ToCodecParameters();
203 codec_params.channels = channels;
204 return codec_params;
205 }
206
193 std::string AudioCodec::ToString() const { 207 std::string AudioCodec::ToString() const {
194 std::ostringstream os; 208 std::ostringstream os;
195 os << "AudioCodec[" << id << ":" << name << ":" << clockrate << ":" << bitrate 209 os << "AudioCodec[" << id << ":" << name << ":" << clockrate << ":" << bitrate
196 << ":" << channels << ":" << preference << "]"; 210 << ":" << channels << ":" << preference << "]";
197 return os.str(); 211 return os.str();
198 } 212 }
199 213
200 std::string VideoCodec::ToString() const { 214 std::string VideoCodec::ToString() const {
201 std::ostringstream os; 215 std::ostringstream os;
202 os << "VideoCodec[" << id << ":" << name << ":" << width << ":" << height 216 os << "VideoCodec[" << id << ":" << name << ":" << width << ":" << height
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bool HasTransportCc(const Codec& codec) { 336 bool HasTransportCc(const Codec& codec) {
323 return codec.HasFeedbackParam( 337 return codec.HasFeedbackParam(
324 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); 338 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
325 } 339 }
326 340
327 bool CodecNamesEq(const std::string& name1, const std::string& name2) { 341 bool CodecNamesEq(const std::string& name1, const std::string& name2) {
328 return _stricmp(name1.c_str(), name2.c_str()) == 0; 342 return _stricmp(name1.c_str(), name2.c_str()) == 0;
329 } 343 }
330 344
331 } // namespace cricket 345 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698