OLD | NEW |
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 | 11 |
12 /* | 12 /* |
13 * This file includes unit tests for the RTCPReceiver. | 13 * This file includes unit tests for the RTCPReceiver. |
14 */ | 14 */ |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
19 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_observer.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_observer.h" |
20 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" |
21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" |
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
33 | 34 |
34 namespace webrtc { | 35 namespace webrtc { |
35 | 36 |
36 namespace { // Anonymous namespace; hide utility functions and classes. | 37 namespace { // Anonymous namespace; hide utility functions and classes. |
37 | 38 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 560 |
560 rtcp::Fir fir; | 561 rtcp::Fir fir; |
561 fir.To(kSourceSsrc + 1); | 562 fir.To(kSourceSsrc + 1); |
562 rtc::scoped_ptr<rtcp::RawPacket> packet(fir.Build()); | 563 rtc::scoped_ptr<rtcp::RawPacket> packet(fir.Build()); |
563 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); | 564 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
564 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); | 565 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
565 } | 566 } |
566 | 567 |
567 TEST_F(RtcpReceiverTest, InjectSliPacket) { | 568 TEST_F(RtcpReceiverTest, InjectSliPacket) { |
568 rtcp::Sli sli; | 569 rtcp::Sli sli; |
569 sli.WithPictureId(40); | 570 sli.WithMacroblocks(40, 0, 1); |
570 rtc::scoped_ptr<rtcp::RawPacket> packet(sli.Build()); | 571 rtc::scoped_ptr<rtcp::RawPacket> packet(sli.Build()); |
571 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); | 572 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
572 EXPECT_EQ(kRtcpSli, rtcp_packet_info_.rtcpPacketTypeFlags); | 573 EXPECT_EQ(kRtcpSli, rtcp_packet_info_.rtcpPacketTypeFlags); |
573 EXPECT_EQ(40, rtcp_packet_info_.sliPictureId); | 574 EXPECT_EQ(40, rtcp_packet_info_.sliPictureId); |
574 } | 575 } |
575 | 576 |
576 TEST_F(RtcpReceiverTest, XrPacketWithZeroReportBlocksIgnored) { | 577 TEST_F(RtcpReceiverTest, XrPacketWithZeroReportBlocksIgnored) { |
577 rtcp::Xr xr; | 578 rtcp::Xr xr; |
578 xr.From(0x2345); | 579 xr.From(0x2345); |
579 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); | 580 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 | 1093 |
1093 // Transport feedback should be ignored, but next packet should work. | 1094 // Transport feedback should be ignored, but next packet should work. |
1094 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); | 1095 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); |
1095 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb); | 1096 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb); |
1096 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate); | 1097 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate); |
1097 } | 1098 } |
1098 | 1099 |
1099 } // Anonymous namespace | 1100 } // Anonymous namespace |
1100 | 1101 |
1101 } // namespace webrtc | 1102 } // namespace webrtc |
OLD | NEW |