OLD | NEW |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 auto rtx_mapping = [this] (int payload_type) { | 75 auto rtx_mapping = [this] (int payload_type) { |
76 return FindMapping({kRtxCodecName, kVideoCodecClockrate, 0, | 76 return FindMapping({kRtxCodecName, kVideoCodecClockrate, 0, |
77 {{ kCodecParamAssociatedPayloadType, std::to_string(payload_type)}}}); | 77 {{ kCodecParamAssociatedPayloadType, std::to_string(payload_type)}}}); |
78 }; | 78 }; |
79 EXPECT_EQ(kDefaultRtxVp8PlType, rtx_mapping(kDefaultVp8PlType)); | 79 EXPECT_EQ(kDefaultRtxVp8PlType, rtx_mapping(kDefaultVp8PlType)); |
80 EXPECT_EQ(kDefaultRtxVp9PlType, rtx_mapping(kDefaultVp9PlType)); | 80 EXPECT_EQ(kDefaultRtxVp9PlType, rtx_mapping(kDefaultVp9PlType)); |
81 EXPECT_EQ(kDefaultRtxH264ConstrainedBaselinePlType, | 81 EXPECT_EQ(kDefaultRtxH264ConstrainedBaselinePlType, |
82 rtx_mapping(kDefaultH264PlType)); | 82 rtx_mapping(kDefaultH264PlType)); |
83 EXPECT_EQ(kDefaultRtxRedPlType, rtx_mapping(kDefaultRedPlType)); | 83 EXPECT_EQ(kDefaultRtxRedPlType, rtx_mapping(kDefaultRedPlType)); |
84 | 84 |
| 85 auto data_mapping = [this] (const char *name) { |
| 86 return FindMapping({name, 0, 0}); |
| 87 }; |
| 88 EXPECT_EQ(kGoogleRtpDataCodecPlType, data_mapping(kGoogleRtpDataCodecName)); |
| 89 EXPECT_EQ(kGoogleSctpDataCodecPlType, data_mapping(kGoogleSctpDataCodecName)); |
| 90 |
85 EXPECT_EQ(102, FindMapping({kIlbcCodecName, 8000, 1})); | 91 EXPECT_EQ(102, FindMapping({kIlbcCodecName, 8000, 1})); |
86 EXPECT_EQ(103, FindMapping({kIsacCodecName, 16000, 1})); | 92 EXPECT_EQ(103, FindMapping({kIsacCodecName, 16000, 1})); |
87 EXPECT_EQ(104, FindMapping({kIsacCodecName, 32000, 1})); | 93 EXPECT_EQ(104, FindMapping({kIsacCodecName, 32000, 1})); |
88 EXPECT_EQ(105, FindMapping({kCnCodecName, 16000, 1})); | 94 EXPECT_EQ(105, FindMapping({kCnCodecName, 16000, 1})); |
89 EXPECT_EQ(106, FindMapping({kCnCodecName, 32000, 1})); | 95 EXPECT_EQ(106, FindMapping({kCnCodecName, 32000, 1})); |
90 EXPECT_EQ(111, FindMapping({kOpusCodecName, 48000, 2, | 96 EXPECT_EQ(111, FindMapping({kOpusCodecName, 48000, 2, |
91 {{"minptime", "10"}, {"useinbandfec", "1"}}})); | 97 {{"minptime", "10"}, {"useinbandfec", "1"}}})); |
| 98 // TODO(solenberg): Remove 16k, 32k, 48k DTMF checks once these payload types |
| 99 // are dynamically assigned. |
| 100 EXPECT_EQ(110, FindMapping({kDtmfCodecName, 48000, 1})); |
| 101 EXPECT_EQ(112, FindMapping({kDtmfCodecName, 32000, 1})); |
| 102 EXPECT_EQ(113, FindMapping({kDtmfCodecName, 16000, 1})); |
92 EXPECT_EQ(126, FindMapping({kDtmfCodecName, 8000, 1})); | 103 EXPECT_EQ(126, FindMapping({kDtmfCodecName, 8000, 1})); |
93 } | 104 } |
94 | 105 |
95 TEST_F(PayloadTypeMapperTest, ValidDynamicPayloadTypes) { | 106 TEST_F(PayloadTypeMapperTest, ValidDynamicPayloadTypes) { |
96 // RFC 3551 says: | 107 // RFC 3551 says: |
97 // "This profile reserves payload type numbers in the range 96-127 | 108 // "This profile reserves payload type numbers in the range 96-127 |
98 // exclusively for dynamic assignment. Applications SHOULD first use | 109 // exclusively for dynamic assignment. Applications SHOULD first use |
99 // values in this range for dynamic payload types. Those applications | 110 // values in this range for dynamic payload types. Those applications |
100 // which need to define more than 32 dynamic payload types MAY bind | 111 // which need to define more than 32 dynamic payload types MAY bind |
101 // codes below 96, in which case it is RECOMMENDED that unassigned | 112 // codes below 96, in which case it is RECOMMENDED that unassigned |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 166 |
156 EXPECT_EQ(codec.id, payload_type); | 167 EXPECT_EQ(codec.id, payload_type); |
157 EXPECT_EQ(codec.name, format.name); | 168 EXPECT_EQ(codec.name, format.name); |
158 EXPECT_EQ(codec.clockrate, format.clockrate_hz); | 169 EXPECT_EQ(codec.clockrate, format.clockrate_hz); |
159 EXPECT_EQ(codec.channels, format.num_channels); | 170 EXPECT_EQ(codec.channels, format.num_channels); |
160 EXPECT_EQ(codec.params, format.parameters); | 171 EXPECT_EQ(codec.params, format.parameters); |
161 } | 172 } |
162 } | 173 } |
163 | 174 |
164 } // namespace cricket | 175 } // namespace cricket |
OLD | NEW |