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

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

Issue 2392883002: Multi frequency DTMF support - sender side (Closed)
Patch Set: rebase 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) 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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 EXPECT_FALSE(voice_activity); 1292 EXPECT_FALSE(voice_activity);
1293 } 1293 }
1294 1294
1295 // As RFC4733, named telephone events are carried as part of the audio stream 1295 // As RFC4733, named telephone events are carried as part of the audio stream
1296 // and must use the same sequence number and timestamp base as the regular 1296 // and must use the same sequence number and timestamp base as the regular
1297 // audio channel. 1297 // audio channel.
1298 // This test checks the marker bit for the first packet and the consequent 1298 // This test checks the marker bit for the first packet and the consequent
1299 // packets of the same telephone event. Since it is specifically for DTMF 1299 // packets of the same telephone event. Since it is specifically for DTMF
1300 // events, ignoring audio packets and sending kEmptyFrame instead of those. 1300 // events, ignoring audio packets and sending kEmptyFrame instead of those.
1301 TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) { 1301 TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) {
1302 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "telephone-event"; 1302 const char* kDtmfPayloadName = "telephone-event";
1303 uint8_t payload_type = 126; 1303 const uint32_t kPayloadFrequency = 8000;
1304 ASSERT_EQ(0, 1304 const uint8_t kPayloadType = 126;
1305 rtp_sender_->RegisterPayload(payload_name, payload_type, 0, 0, 0)); 1305 ASSERT_EQ(0, rtp_sender_->RegisterPayload(kDtmfPayloadName, kPayloadType,
1306 kPayloadFrequency, 0, 0));
1306 // For Telephone events, payload is not added to the registered payload list, 1307 // For Telephone events, payload is not added to the registered payload list,
1307 // it will register only the payload used for audio stream. 1308 // it will register only the payload used for audio stream.
1308 // Registering the payload again for audio stream with different payload name. 1309 // Registering the payload again for audio stream with different payload name.
1309 const char kPayloadName[] = "payload_name"; 1310 const char* kPayloadName = "payload_name";
1310 ASSERT_EQ( 1311 ASSERT_EQ(0, rtp_sender_->RegisterPayload(kPayloadName, kPayloadType,
1311 0, rtp_sender_->RegisterPayload(kPayloadName, payload_type, 8000, 1, 0)); 1312 kPayloadFrequency, 1, 0));
1312 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); 1313 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
1313 // DTMF event key=9, duration=500 and attenuationdB=10 1314 // DTMF event key=9, duration=500 and attenuationdB=10
1314 rtp_sender_->SendTelephoneEvent(9, 500, 10); 1315 rtp_sender_->SendTelephoneEvent(9, 500, 10);
1315 // During start, it takes the starting timestamp as last sent timestamp. 1316 // During start, it takes the starting timestamp as last sent timestamp.
1316 // The duration is calculated as the difference of current and last sent 1317 // The duration is calculated as the difference of current and last sent
1317 // timestamp. So for first call it will skip since the duration is zero. 1318 // timestamp. So for first call it will skip since the duration is zero.
1318 ASSERT_TRUE(rtp_sender_->SendOutgoingData(kEmptyFrame, payload_type, 1319 ASSERT_TRUE(rtp_sender_->SendOutgoingData(kEmptyFrame, kPayloadType,
1319 capture_time_ms, 0, nullptr, 0, 1320 capture_time_ms, 0, nullptr, 0,
1320 nullptr, nullptr, nullptr)); 1321 nullptr, nullptr, nullptr));
1321 // DTMF Sample Length is (Frequency/1000) * Duration. 1322 // DTMF Sample Length is (Frequency/1000) * Duration.
1322 // So in this case, it is (8000/1000) * 500 = 4000. 1323 // So in this case, it is (8000/1000) * 500 = 4000.
1323 // Sending it as two packets. 1324 // Sending it as two packets.
1324 ASSERT_TRUE(rtp_sender_->SendOutgoingData( 1325 ASSERT_TRUE(rtp_sender_->SendOutgoingData(
1325 kEmptyFrame, payload_type, capture_time_ms + 2000, 0, 1326 kEmptyFrame, kPayloadType, capture_time_ms + 2000, 0,
1326 nullptr, 0, nullptr, nullptr, nullptr)); 1327 nullptr, 0, nullptr, nullptr, nullptr));
1327 1328
1328 // Marker Bit should be set to 1 for first packet. 1329 // Marker Bit should be set to 1 for first packet.
1329 EXPECT_TRUE(transport_.last_sent_packet().Marker()); 1330 EXPECT_TRUE(transport_.last_sent_packet().Marker());
1330 1331
1331 ASSERT_TRUE(rtp_sender_->SendOutgoingData( 1332 ASSERT_TRUE(rtp_sender_->SendOutgoingData(
1332 kEmptyFrame, payload_type, capture_time_ms + 4000, 0, 1333 kEmptyFrame, kPayloadType, capture_time_ms + 4000, 0,
1333 nullptr, 0, nullptr, nullptr, nullptr)); 1334 nullptr, 0, nullptr, nullptr, nullptr));
1334 // Marker Bit should be set to 0 for rest of the packets. 1335 // Marker Bit should be set to 0 for rest of the packets.
1335 EXPECT_FALSE(transport_.last_sent_packet().Marker()); 1336 EXPECT_FALSE(transport_.last_sent_packet().Marker());
1336 } 1337 }
1337 1338
1338 TEST_F(RtpSenderTestWithoutPacer, BytesReportedCorrectly) { 1339 TEST_F(RtpSenderTestWithoutPacer, BytesReportedCorrectly) {
1339 const char* kPayloadName = "GENERIC"; 1340 const char* kPayloadName = "GENERIC";
1340 const uint8_t kPayloadType = 127; 1341 const uint8_t kPayloadType = 127;
1341 rtp_sender_->SetSSRC(1234); 1342 rtp_sender_->SetSSRC(1234);
1342 rtp_sender_->SetRtxSsrc(4321); 1343 rtp_sender_->SetRtxSsrc(4321);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1); 1538 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1);
1538 rtp_sender_->SetTransportOverhead(28); 1539 rtp_sender_->SetTransportOverhead(28);
1539 rtp_sender_->SetTransportOverhead(28); 1540 rtp_sender_->SetTransportOverhead(28);
1540 1541
1541 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1); 1542 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1);
1542 SendGenericPayload(); 1543 SendGenericPayload();
1543 SendGenericPayload(); 1544 SendGenericPayload();
1544 } 1545 }
1545 1546
1546 } // namespace webrtc 1547 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698