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 2525283002: Add overhead to transport feedback observer. (Closed)
Patch Set: Created 4 years 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/modules/rtp_rtcp/source/rtp_sender.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) 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
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "webrtc/base/buffer.h" 14 #include "webrtc/base/buffer.h"
15 #include "webrtc/base/rate_limiter.h" 15 #include "webrtc/base/rate_limiter.h"
16 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" 16 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" 17 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 23 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" 24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
29 #include "webrtc/system_wrappers/include/stl_util.h" 29 #include "webrtc/system_wrappers/include/stl_util.h"
30 #include "webrtc/test/field_trial.h"
30 #include "webrtc/test/gmock.h" 31 #include "webrtc/test/gmock.h"
31 #include "webrtc/test/gtest.h" 32 #include "webrtc/test/gtest.h"
32 #include "webrtc/test/mock_transport.h" 33 #include "webrtc/test/mock_transport.h"
33 #include "webrtc/typedefs.h" 34 #include "webrtc/typedefs.h"
34 35
35 namespace webrtc { 36 namespace webrtc {
36 37
37 namespace { 38 namespace {
38 const int kTransmissionTimeOffsetExtensionId = 1; 39 const int kTransmissionTimeOffsetExtensionId = 1;
39 const int kAbsoluteSendTimeExtensionId = 14; 40 const int kAbsoluteSendTimeExtensionId = 14;
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 1524
1524 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1); 1525 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1);
1525 rtp_sender_->SetTransportOverhead(28); 1526 rtp_sender_->SetTransportOverhead(28);
1526 rtp_sender_->SetTransportOverhead(28); 1527 rtp_sender_->SetTransportOverhead(28);
1527 1528
1528 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1); 1529 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1);
1529 SendGenericPayload(); 1530 SendGenericPayload();
1530 SendGenericPayload(); 1531 SendGenericPayload();
1531 } 1532 }
1532 1533
1534 TEST_F(RtpSenderTest, AddOverheadToTransportFeedbackObserver) {
1535 constexpr int kTransportOverheadBytesPerPacket = 28;
1536 constexpr int kRtpOverheadBytesPerPacket = 12 + 8;
1537 test::ScopedFieldTrials override_field_trials_(
1538 "WebRTC-SendSideBwe-WithOverhead/Enabled/");
1539 MockOverheadObserver mock_overhead_observer;
1540 rtp_sender_.reset(new RTPSender(
1541 false, &fake_clock_, &transport_, &mock_paced_sender_, nullptr,
1542 &seq_num_allocator_, &feedback_observer_, nullptr, nullptr, nullptr,
1543 &mock_rtc_event_log_, &send_packet_observer_,
1544 &retransmission_rate_limiter_, &mock_overhead_observer));
1545 rtp_sender_->SetSequenceNumber(kSeqNum);
1546 rtp_sender_->SetSSRC(kSsrc);
1547 rtp_sender_->SetStorePacketsStatus(true, 10);
1548 EXPECT_CALL(mock_overhead_observer,
1549 OnOverheadChanged(kTransportOverheadBytesPerPacket))
1550 .Times(1);
1551 rtp_sender_->SetTransportOverhead(kTransportOverheadBytesPerPacket);
1552 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
1553 kRtpExtensionTransportSequenceNumber,
1554 kTransportSequenceNumberExtensionId));
1555
1556 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, kSsrc, kSeqNum, _, _, _));
1557 EXPECT_CALL(seq_num_allocator_, AllocateSequenceNumber())
1558 .WillOnce(testing::Return(kTransportSequenceNumber));
1559 EXPECT_CALL(send_packet_observer_,
1560 OnSendPacket(kTransportSequenceNumber, _, _))
1561 .Times(1);
stefan-webrtc 2016/11/28 15:21:11 Seems like we can skip most of these EXPECT_CALLs,
michaelt 2016/11/29 08:22:52 There is still som preparation needed but i could
1562 const int kProbeClusterId = 1;
1563 EXPECT_CALL(feedback_observer_,
1564 AddPacket(kTransportSequenceNumber,
1565 sizeof(kPayloadData) + kGenericHeaderLength +
1566 kRtpOverheadBytesPerPacket +
1567 kTransportOverheadBytesPerPacket,
1568 kProbeClusterId))
1569 .Times(1);
1570 EXPECT_CALL(mock_overhead_observer,
1571 OnOverheadChanged(kTransportOverheadBytesPerPacket +
1572 kRtpOverheadBytesPerPacket))
1573 .Times(1);
1574 SendGenericPayload();
1575 rtp_sender_->TimeToSendPacket(
1576 kSsrc, kSeqNum, fake_clock_.TimeInMilliseconds(), false, kProbeClusterId);
1577 }
1578
1533 } // namespace webrtc 1579 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698