Chromium Code Reviews| 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 |
| 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" |
| 12 | 12 |
| 13 #include "testing/gmock/include/gmock/gmock.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | |
| 15 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | |
| 16 #include "webrtc/test/rtcp_packet_parser.h" | 15 #include "webrtc/test/rtcp_packet_parser.h" |
| 17 | 16 |
| 17 using webrtc::rtcp::Fir; | |
| 18 using webrtc::rtcp::RawPacket; | 18 using webrtc::rtcp::RawPacket; |
| 19 using webrtc::rtcp::Tmmbr; | |
| 20 using webrtc::test::RtcpPacketParser; | 19 using webrtc::test::RtcpPacketParser; |
| 21 | 20 |
| 22 namespace webrtc { | 21 namespace webrtc { |
| 22 | |
| 23 const uint32_t kSenderSsrc = 0x12345678; | 23 const uint32_t kSenderSsrc = 0x12345678; |
| 24 const uint32_t kRemoteSsrc = 0x23456789; | 24 const uint32_t kRemoteSsrc = 0x23456789; |
| 25 | 25 |
| 26 TEST(RtcpPacketTest, Tmmbr) { | 26 TEST(RtcpPacketTest, Fir) { |
|
åsapersson
2016/01/15 10:48:04
s/RtcpPacketTest/RtcpPacketFirTest
| |
| 27 Tmmbr tmmbr; | 27 Fir fir; |
| 28 tmmbr.From(kSenderSsrc); | 28 fir.From(kSenderSsrc); |
| 29 tmmbr.To(kRemoteSsrc); | 29 fir.To(kRemoteSsrc); |
| 30 tmmbr.WithBitrateKbps(312); | 30 fir.WithCommandSeqNum(123); |
| 31 tmmbr.WithOverhead(60); | |
| 32 | 31 |
| 33 rtc::scoped_ptr<RawPacket> packet(tmmbr.Build()); | 32 rtc::scoped_ptr<RawPacket> packet(fir.Build()); |
| 34 RtcpPacketParser parser; | 33 RtcpPacketParser parser; |
| 35 parser.Parse(packet->Buffer(), packet->Length()); | 34 parser.Parse(packet->Buffer(), packet->Length()); |
| 36 EXPECT_EQ(1, parser.tmmbr()->num_packets()); | 35 EXPECT_EQ(1, parser.fir()->num_packets()); |
| 37 EXPECT_EQ(kSenderSsrc, parser.tmmbr()->Ssrc()); | 36 EXPECT_EQ(kSenderSsrc, parser.fir()->Ssrc()); |
| 38 EXPECT_EQ(1, parser.tmmbr_item()->num_packets()); | 37 EXPECT_EQ(1, parser.fir_item()->num_packets()); |
| 39 EXPECT_EQ(312U, parser.tmmbr_item()->BitrateKbps()); | 38 EXPECT_EQ(kRemoteSsrc, parser.fir_item()->Ssrc()); |
| 40 EXPECT_EQ(60U, parser.tmmbr_item()->Overhead()); | 39 EXPECT_EQ(123U, parser.fir_item()->SeqNum()); |
| 41 } | 40 } |
| 42 | 41 |
| 43 } // namespace webrtc | 42 } // namespace webrtc |
| OLD | NEW |