OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 number_of_rtcp_packets_(0), | 54 number_of_rtcp_packets_(0), |
55 paused_(false) {} | 55 paused_(false) {} |
56 | 56 |
57 // A singular packet implies a RTCP packet. | 57 // A singular packet implies a RTCP packet. |
58 bool SendPacket(PacketRef packet, const base::Closure& cb) final { | 58 bool SendPacket(PacketRef packet, const base::Closure& cb) final { |
59 if (paused_) { | 59 if (paused_) { |
60 stored_packet_ = packet; | 60 stored_packet_ = packet; |
61 callback_ = cb; | 61 callback_ = cb; |
62 return false; | 62 return false; |
63 } | 63 } |
64 if (Rtcp::IsRtcpPacket(&packet->data[0], packet->data.size())) { | 64 if (IsRtcpPacket(&packet->data[0], packet->data.size())) { |
65 ++number_of_rtcp_packets_; | 65 ++number_of_rtcp_packets_; |
66 } else { | 66 } else { |
67 // Check that at least one RTCP packet was sent before the first RTP | 67 // Check that at least one RTCP packet was sent before the first RTP |
68 // packet. This confirms that the receiver will have the necessary lip | 68 // packet. This confirms that the receiver will have the necessary lip |
69 // sync info before it has to calculate the playout time of the first | 69 // sync info before it has to calculate the playout time of the first |
70 // frame. | 70 // frame. |
71 if (number_of_rtp_packets_ == 0) | 71 if (number_of_rtp_packets_ == 0) |
72 EXPECT_LE(1, number_of_rtcp_packets_); | 72 EXPECT_LE(1, number_of_rtcp_packets_); |
73 ++number_of_rtp_packets_; | 73 ++number_of_rtp_packets_; |
74 } | 74 } |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 << ", hfr=" << kTestCases[i].high_frame_rate); | 656 << ", hfr=" << kTestCases[i].high_frame_rate); |
657 const scoped_refptr<VideoFrame> frame = | 657 const scoped_refptr<VideoFrame> frame = |
658 CreateFakeFrame(resolution, kTestCases[i].high_frame_rate); | 658 CreateFakeFrame(resolution, kTestCases[i].high_frame_rate); |
659 EXPECT_EQ(kTestCases[i].expected_bitrate, | 659 EXPECT_EQ(kTestCases[i].expected_bitrate, |
660 PeerVideoSender::GetMaximumTargetBitrateForFrame(*frame)); | 660 PeerVideoSender::GetMaximumTargetBitrateForFrame(*frame)); |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 } // namespace cast | 664 } // namespace cast |
665 } // namespace media | 665 } // namespace media |
OLD | NEW |