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

Side by Side Diff: webrtc/common_video/h264/profile_level_id.cc

Issue 2483173002: Negotiate H264 profiles in SDP (Closed)
Patch Set: Extract IsSameH264Profile and don't check payload type in FindMatchingCodec Created 4 years, 1 month 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 char str[7]; 256 char str[7];
257 snprintf(str, 7u, "%s%02x", profile_idc_iop_string, profile_level_id.level); 257 snprintf(str, 7u, "%s%02x", profile_idc_iop_string, profile_level_id.level);
258 return rtc::Optional<std::string>(str); 258 return rtc::Optional<std::string>(str);
259 } 259 }
260 260
261 // Set level according to https://tools.ietf.org/html/rfc6184#section-8.2.2. 261 // Set level according to https://tools.ietf.org/html/rfc6184#section-8.2.2.
262 void GenerateProfileLevelIdForAnswer( 262 void GenerateProfileLevelIdForAnswer(
263 const CodecParameterMap& local_supported_params, 263 const CodecParameterMap& local_supported_params,
264 const CodecParameterMap& remote_offered_params, 264 const CodecParameterMap& remote_offered_params,
265 CodecParameterMap* answer_params) { 265 CodecParameterMap* answer_params) {
266 // If both local and remote haven't set profile-level-id, they are both using
267 // the default profile. In this case, don't set profile-level-id in answer
268 // either.
269 if (!local_supported_params.count(kProfileLevelId) &&
270 !remote_offered_params.count(kProfileLevelId)) {
271 return;
272 }
273
266 // Parse profile-level-ids. 274 // Parse profile-level-ids.
267 const rtc::Optional<ProfileLevelId> local_profile_level_id = 275 const rtc::Optional<ProfileLevelId> local_profile_level_id =
268 ParseSdpProfileLevelId(local_supported_params); 276 ParseSdpProfileLevelId(local_supported_params);
269 const rtc::Optional<ProfileLevelId> remote_profile_level_id = 277 const rtc::Optional<ProfileLevelId> remote_profile_level_id =
270 ParseSdpProfileLevelId(remote_offered_params); 278 ParseSdpProfileLevelId(remote_offered_params);
271 // The local and remote codec must have valid and equal H264 Profiles. 279 // The local and remote codec must have valid and equal H264 Profiles.
272 RTC_DCHECK(local_profile_level_id); 280 RTC_DCHECK(local_profile_level_id);
273 RTC_DCHECK(remote_profile_level_id); 281 RTC_DCHECK(remote_profile_level_id);
274 RTC_DCHECK_EQ(local_profile_level_id->profile, 282 RTC_DCHECK_EQ(local_profile_level_id->profile,
275 remote_profile_level_id->profile); 283 remote_profile_level_id->profile);
(...skipping 11 matching lines...) Expand all
287 // than the level in the offer. 295 // than the level in the offer.
288 const Level answer_level = level_asymmetry_allowed ? local_level : min_level; 296 const Level answer_level = level_asymmetry_allowed ? local_level : min_level;
289 297
290 // Set the resulting profile-level-id in the answer parameters. 298 // Set the resulting profile-level-id in the answer parameters.
291 (*answer_params)[kProfileLevelId] = *ProfileLevelIdToString( 299 (*answer_params)[kProfileLevelId] = *ProfileLevelIdToString(
292 ProfileLevelId(local_profile_level_id->profile, answer_level)); 300 ProfileLevelId(local_profile_level_id->profile, answer_level));
293 } 301 }
294 302
295 } // namespace H264 303 } // namespace H264
296 } // namespace webrtc 304 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/android/jni/androidmediaencoder_jni.cc ('k') | webrtc/common_video/h264/profile_level_id_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698