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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 2497773003: Use different RTX payload types for different H264 profiles (Closed)
Patch Set: 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
« no previous file with comments | « webrtc/media/engine/payload_type_mapper_unittest.cc ('k') | no next file » | 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
11 #include "webrtc/media/engine/webrtcvideoengine2.h" 11 #include "webrtc/media/engine/webrtcvideoengine2.h"
12 12
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <algorithm> 14 #include <algorithm>
15 #include <set> 15 #include <set>
16 #include <string> 16 #include <string>
17 #include <utility> 17 #include <utility>
18 18
19 #include "webrtc/base/copyonwritebuffer.h" 19 #include "webrtc/base/copyonwritebuffer.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/base/stringutils.h" 21 #include "webrtc/base/stringutils.h"
22 #include "webrtc/base/timeutils.h" 22 #include "webrtc/base/timeutils.h"
23 #include "webrtc/base/trace_event.h" 23 #include "webrtc/base/trace_event.h"
24 #include "webrtc/call.h" 24 #include "webrtc/call.h"
25 #include "webrtc/common_video/h264/profile_level_id.h"
25 #include "webrtc/media/engine/constants.h" 26 #include "webrtc/media/engine/constants.h"
26 #include "webrtc/media/engine/simulcast.h" 27 #include "webrtc/media/engine/simulcast.h"
27 #include "webrtc/media/engine/webrtcmediaengine.h" 28 #include "webrtc/media/engine/webrtcmediaengine.h"
28 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" 29 #include "webrtc/media/engine/webrtcvideoencoderfactory.h"
29 #include "webrtc/media/engine/webrtcvoiceengine.h" 30 #include "webrtc/media/engine/webrtcvoiceengine.h"
30 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 31 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
31 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" 32 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h"
32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 33 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
33 #include "webrtc/system_wrappers/include/field_trial.h" 34 #include "webrtc/system_wrappers/include/field_trial.h"
34 #include "webrtc/video_decoder.h" 35 #include "webrtc/video_decoder.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // don't recognize? 397 // don't recognize?
397 void AddCodecAndMaybeRtxCodec(const VideoCodec& codec, 398 void AddCodecAndMaybeRtxCodec(const VideoCodec& codec,
398 std::vector<VideoCodec>* codecs) { 399 std::vector<VideoCodec>* codecs) {
399 codecs->push_back(codec); 400 codecs->push_back(codec);
400 int rtx_payload_type = 0; 401 int rtx_payload_type = 0;
401 if (CodecNamesEq(codec.name, kVp8CodecName)) { 402 if (CodecNamesEq(codec.name, kVp8CodecName)) {
402 rtx_payload_type = kDefaultRtxVp8PlType; 403 rtx_payload_type = kDefaultRtxVp8PlType;
403 } else if (CodecNamesEq(codec.name, kVp9CodecName)) { 404 } else if (CodecNamesEq(codec.name, kVp9CodecName)) {
404 rtx_payload_type = kDefaultRtxVp9PlType; 405 rtx_payload_type = kDefaultRtxVp9PlType;
405 } else if (CodecNamesEq(codec.name, kH264CodecName)) { 406 } else if (CodecNamesEq(codec.name, kH264CodecName)) {
406 rtx_payload_type = kDefaultRtxH264PlType; 407 // Parse H264 profile.
408 const rtc::Optional<webrtc::H264::ProfileLevelId> profile_level_id =
409 webrtc::H264::ParseSdpProfileLevelId(codec.params);
410 if (!profile_level_id)
411 return;
412 const webrtc::H264::Profile profile = profile_level_id->profile;
413 // Only supported rtx for constrained baseline and constrained high profile.
hta-webrtc 2016/11/15 10:41:07 Grammar nit: "In H.264, we only support rtx for co
magjed_webrtc 2016/11/15 17:48:04 Done.
414 if (profile == webrtc::H264::kProfileConstrainedBaseline) {
415 rtx_payload_type = kDefaultRtxH264ConstrainedBaselinePlType;
416 } else if (profile == webrtc::H264::kProfileConstrainedHigh) {
417 rtx_payload_type = kDefaultRtxH264ConstrainedHighPlType;
418 }
hta-webrtc 2016/11/15 10:41:07 "Else" missing - if this is neither of the two abo
magjed_webrtc 2016/11/15 17:48:04 Done.
407 } else if (CodecNamesEq(codec.name, kRedCodecName)) { 419 } else if (CodecNamesEq(codec.name, kRedCodecName)) {
408 rtx_payload_type = kDefaultRtxRedPlType; 420 rtx_payload_type = kDefaultRtxRedPlType;
409 } else { 421 } else {
410 return; 422 return;
411 } 423 }
412 codecs->push_back(VideoCodec::CreateRtxCodec(rtx_payload_type, codec.id)); 424 codecs->push_back(VideoCodec::CreateRtxCodec(rtx_payload_type, codec.id));
413 } 425 }
414 426
415 std::vector<VideoCodec> DefaultVideoCodecList() { 427 std::vector<VideoCodec> DefaultVideoCodecList() {
416 std::vector<VideoCodec> codecs; 428 std::vector<VideoCodec> codecs;
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 rtx_mapping[video_codecs[i].codec.id] != 2564 rtx_mapping[video_codecs[i].codec.id] !=
2553 ulpfec_config.red_payload_type) { 2565 ulpfec_config.red_payload_type) {
2554 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2566 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2555 } 2567 }
2556 } 2568 }
2557 2569
2558 return video_codecs; 2570 return video_codecs;
2559 } 2571 }
2560 2572
2561 } // namespace cricket 2573 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/payload_type_mapper_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698