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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc

Issue 1371043003: Unify FrameType and VideoFrameType. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 1241
1242 EXPECT_EQ(0, memcmp(extension, payload_data - sizeof(extension), 1242 EXPECT_EQ(0, memcmp(extension, payload_data - sizeof(extension),
1243 sizeof(extension))); 1243 sizeof(extension)));
1244 } 1244 }
1245 1245
1246 // As RFC4733, named telephone events are carried as part of the audio stream 1246 // As RFC4733, named telephone events are carried as part of the audio stream
1247 // and must use the same sequence number and timestamp base as the regular 1247 // and must use the same sequence number and timestamp base as the regular
1248 // audio channel. 1248 // audio channel.
1249 // This test checks the marker bit for the first packet and the consequent 1249 // This test checks the marker bit for the first packet and the consequent
1250 // packets of the same telephone event. Since it is specifically for DTMF 1250 // packets of the same telephone event. Since it is specifically for DTMF
1251 // events, ignoring audio packets and sending kFrameEmpty instead of those. 1251 // events, ignoring audio packets and sending kSkipFrame instead of those.
1252 TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) { 1252 TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) {
1253 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "telephone-event"; 1253 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "telephone-event";
1254 uint8_t payload_type = 126; 1254 uint8_t payload_type = 126;
1255 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 0, 1255 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 0,
1256 0, 0)); 1256 0, 0));
1257 // For Telephone events, payload is not added to the registered payload list, 1257 // For Telephone events, payload is not added to the registered payload list,
1258 // it will register only the payload used for audio stream. 1258 // it will register only the payload used for audio stream.
1259 // Registering the payload again for audio stream with different payload name. 1259 // Registering the payload again for audio stream with different payload name.
1260 strcpy(payload_name, "payload_name"); 1260 strcpy(payload_name, "payload_name");
1261 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 8000, 1261 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 8000,
1262 1, 0)); 1262 1, 0));
1263 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); 1263 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
1264 // DTMF event key=9, duration=500 and attenuationdB=10 1264 // DTMF event key=9, duration=500 and attenuationdB=10
1265 rtp_sender_->SendTelephoneEvent(9, 500, 10); 1265 rtp_sender_->SendTelephoneEvent(9, 500, 10);
1266 // During start, it takes the starting timestamp as last sent timestamp. 1266 // During start, it takes the starting timestamp as last sent timestamp.
1267 // The duration is calculated as the difference of current and last sent 1267 // The duration is calculated as the difference of current and last sent
1268 // timestamp. So for first call it will skip since the duration is zero. 1268 // timestamp. So for first call it will skip since the duration is zero.
1269 ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kFrameEmpty, payload_type, 1269 ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kSkipFrame, payload_type,
1270 capture_time_ms, 0, nullptr, 0, 1270 capture_time_ms, 0, nullptr, 0,
1271 nullptr)); 1271 nullptr));
1272 // DTMF Sample Length is (Frequency/1000) * Duration. 1272 // DTMF Sample Length is (Frequency/1000) * Duration.
1273 // So in this case, it is (8000/1000) * 500 = 4000. 1273 // So in this case, it is (8000/1000) * 500 = 4000.
1274 // Sending it as two packets. 1274 // Sending it as two packets.
1275 ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kFrameEmpty, payload_type, 1275 ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kSkipFrame, payload_type,
1276 capture_time_ms + 2000, 0, nullptr, 1276 capture_time_ms + 2000, 0, nullptr,
1277 0, nullptr)); 1277 0, nullptr));
1278 rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser( 1278 rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser(
1279 webrtc::RtpHeaderParser::Create()); 1279 webrtc::RtpHeaderParser::Create());
1280 ASSERT_TRUE(rtp_parser.get() != nullptr); 1280 ASSERT_TRUE(rtp_parser.get() != nullptr);
1281 webrtc::RTPHeader rtp_header; 1281 webrtc::RTPHeader rtp_header;
1282 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, 1282 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_,
1283 transport_.last_sent_packet_len_, 1283 transport_.last_sent_packet_len_,
1284 &rtp_header)); 1284 &rtp_header));
1285 // Marker Bit should be set to 1 for first packet. 1285 // Marker Bit should be set to 1 for first packet.
1286 EXPECT_TRUE(rtp_header.markerBit); 1286 EXPECT_TRUE(rtp_header.markerBit);
1287 1287
1288 ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kFrameEmpty, payload_type, 1288 ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kSkipFrame, payload_type,
1289 capture_time_ms + 4000, 0, nullptr, 1289 capture_time_ms + 4000, 0, nullptr,
1290 0, nullptr)); 1290 0, nullptr));
1291 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, 1291 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_,
1292 transport_.last_sent_packet_len_, 1292 transport_.last_sent_packet_len_,
1293 &rtp_header)); 1293 &rtp_header));
1294 // Marker Bit should be set to 0 for rest of the packets. 1294 // Marker Bit should be set to 0 for rest of the packets.
1295 EXPECT_FALSE(rtp_header.markerBit); 1295 EXPECT_FALSE(rtp_header.markerBit);
1296 } 1296 }
1297 1297
1298 TEST_F(RtpSenderTest, BytesReportedCorrectly) { 1298 TEST_F(RtpSenderTest, BytesReportedCorrectly) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), 1402 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()),
1403 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); 1403 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation);
1404 1404
1405 // Verify that this packet does have CVO byte. 1405 // Verify that this packet does have CVO byte.
1406 VerifyCVOPacket( 1406 VerifyCVOPacket(
1407 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), 1407 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()),
1408 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, 1408 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1,
1409 hdr.rotation); 1409 hdr.rotation);
1410 } 1410 }
1411 } // namespace webrtc 1411 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698