OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "media/cast/cast_defines.h" | 6 #include "media/cast/cast_defines.h" |
7 #include "media/cast/pacing/paced_sender.h" | 7 #include "media/cast/pacing/paced_sender.h" |
8 #include "media/cast/rtcp/rtcp_sender.h" | 8 #include "media/cast/rtcp/rtcp_sender.h" |
9 #include "media/cast/rtcp/test_rtcp_packet_builder.h" | 9 #include "media/cast/rtcp/test_rtcp_packet_builder.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 virtual bool SendRtcpPacket(const std::vector<uint8>& packet) OVERRIDE { | 27 virtual bool SendRtcpPacket(const std::vector<uint8>& packet) OVERRIDE { |
28 EXPECT_EQ(expected_packet_length_, packet.size()); | 28 EXPECT_EQ(expected_packet_length_, packet.size()); |
29 EXPECT_EQ(0, memcmp(expected_packet_, &(packet[0]), packet.size())); | 29 EXPECT_EQ(0, memcmp(expected_packet_, &(packet[0]), packet.size())); |
30 packet_count_++; | 30 packet_count_++; |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 virtual bool SendPacket(const std::vector<uint8>& packet, | 34 virtual bool SendPacket(const std::vector<uint8>& packet, |
35 int num_of_packets) { | 35 int num_of_packets) OVERRIDE { |
36 return false; | 36 return false; |
37 } | 37 } |
38 | 38 |
39 virtual bool ResendPacket(const std::vector<uint8>& packet, | 39 virtual bool ResendPacket(const std::vector<uint8>& packet, |
40 int num_of_packets) { | 40 int num_of_packets) OVERRIDE { |
41 return false; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 void SetExpectedRtcpPacket(const uint8* rtcp_buffer, int length) { | 44 void SetExpectedRtcpPacket(const uint8* rtcp_buffer, int length) { |
45 expected_packet_length_ = length; | 45 expected_packet_length_ = length; |
46 memcpy(expected_packet_, rtcp_buffer, length); | 46 memcpy(expected_packet_, rtcp_buffer, length); |
47 } | 47 } |
48 | 48 |
49 int packet_count() { return packet_count_; } | 49 int packet_count() { return packet_count_; } |
50 | 50 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 report_block.media_ssrc = kMediaSsrc; // SSRC of the RTP packet sender. | 221 report_block.media_ssrc = kMediaSsrc; // SSRC of the RTP packet sender. |
222 report_block.fraction_lost = kLoss >> 24; | 222 report_block.fraction_lost = kLoss >> 24; |
223 report_block.cumulative_lost = kLoss; // 24 bits valid. | 223 report_block.cumulative_lost = kLoss; // 24 bits valid. |
224 report_block.extended_high_sequence_number = kExtendedMax; | 224 report_block.extended_high_sequence_number = kExtendedMax; |
225 report_block.jitter = kJitter; | 225 report_block.jitter = kJitter; |
226 report_block.last_sr = kLastSr; | 226 report_block.last_sr = kLastSr; |
227 report_block.delay_since_last_sr = kDelayLastSr; | 227 report_block.delay_since_last_sr = kDelayLastSr; |
228 | 228 |
229 RtcpCastMessage cast_message(kMediaSsrc); | 229 RtcpCastMessage cast_message(kMediaSsrc); |
230 cast_message.ack_frame_id_ = kAckFrameId; | 230 cast_message.ack_frame_id_ = kAckFrameId; |
231 std::set<uint16_t> missing_packets; | 231 std::set<uint16> missing_packets; |
232 cast_message.missing_frames_and_packets_[ | 232 cast_message.missing_frames_and_packets_[ |
233 kLostFrameId] = missing_packets; | 233 kLostFrameId] = missing_packets; |
234 | 234 |
235 missing_packets.insert(kLostPacketId1); | 235 missing_packets.insert(kLostPacketId1); |
236 missing_packets.insert(kLostPacketId2); | 236 missing_packets.insert(kLostPacketId2); |
237 missing_packets.insert(kLostPacketId3); | 237 missing_packets.insert(kLostPacketId3); |
238 cast_message.missing_frames_and_packets_[kFrameIdWithLostPackets] = | 238 cast_message.missing_frames_and_packets_[kFrameIdWithLostPackets] = |
239 missing_packets; | 239 missing_packets; |
240 | 240 |
241 rtcp_sender_->SendRtcp(RtcpSender::kRtcpRr | RtcpSender::kRtcpCast, | 241 rtcp_sender_->SendRtcp(RtcpSender::kRtcpRr | RtcpSender::kRtcpCast, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 kMediaSsrc, | 276 kMediaSsrc, |
277 NULL, | 277 NULL, |
278 NULL, | 278 NULL, |
279 NULL); | 279 NULL); |
280 | 280 |
281 EXPECT_EQ(1, test_transport_.packet_count()); | 281 EXPECT_EQ(1, test_transport_.packet_count()); |
282 } | 282 } |
283 | 283 |
284 } // namespace cast | 284 } // namespace cast |
285 } // namespace media | 285 } // namespace media |
OLD | NEW |