| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
| 9 #include "media/cast/net/rtcp/rtcp.h" | 9 #include "media/cast/net/rtcp/rtcp.h" |
| 10 #include "media/cast/net/rtp/cast_message_builder.h" | 10 #include "media/cast/net/rtp/cast_message_builder.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static const int64 kStartMillisecond = INT64_C(12345678900000); | 21 static const int64 kStartMillisecond = INT64_C(12345678900000); |
| 22 | 22 |
| 23 typedef std::map<uint32, size_t> MissingPacketsMap; | 23 typedef std::map<uint32, size_t> MissingPacketsMap; |
| 24 | 24 |
| 25 class NackFeedbackVerification : public RtpPayloadFeedback { | 25 class NackFeedbackVerification : public RtpPayloadFeedback { |
| 26 public: | 26 public: |
| 27 NackFeedbackVerification() | 27 NackFeedbackVerification() |
| 28 : triggered_(false), missing_packets_(), last_frame_acked_(0) {} | 28 : triggered_(false), missing_packets_(), last_frame_acked_(0) {} |
| 29 | 29 |
| 30 virtual void CastFeedback(const RtcpCastMessage& cast_feedback) OVERRIDE { | 30 virtual void CastFeedback(const RtcpCastMessage& cast_feedback) OVERRIDE { |
| 31 EXPECT_EQ(kSsrc, cast_feedback.media_ssrc_); | 31 EXPECT_EQ(kSsrc, cast_feedback.media_ssrc); |
| 32 | 32 |
| 33 last_frame_acked_ = cast_feedback.ack_frame_id_; | 33 last_frame_acked_ = cast_feedback.ack_frame_id; |
| 34 | 34 |
| 35 MissingFramesAndPacketsMap::const_iterator frame_it = | 35 MissingFramesAndPacketsMap::const_iterator frame_it = |
| 36 cast_feedback.missing_frames_and_packets_.begin(); | 36 cast_feedback.missing_frames_and_packets.begin(); |
| 37 | 37 |
| 38 // Keep track of the number of missing packets per frame. | 38 // Keep track of the number of missing packets per frame. |
| 39 missing_packets_.clear(); | 39 missing_packets_.clear(); |
| 40 while (frame_it != cast_feedback.missing_frames_and_packets_.end()) { | 40 while (frame_it != cast_feedback.missing_frames_and_packets.end()) { |
| 41 // Check for complete frame lost. | 41 // Check for complete frame lost. |
| 42 if ((frame_it->second.size() == 1) && | 42 if ((frame_it->second.size() == 1) && |
| 43 (*frame_it->second.begin() == kRtcpCastAllPacketsLost)) { | 43 (*frame_it->second.begin() == kRtcpCastAllPacketsLost)) { |
| 44 missing_packets_.insert( | 44 missing_packets_.insert( |
| 45 std::make_pair(frame_it->first, kRtcpCastAllPacketsLost)); | 45 std::make_pair(frame_it->first, kRtcpCastAllPacketsLost)); |
| 46 } else { | 46 } else { |
| 47 missing_packets_.insert( | 47 missing_packets_.insert( |
| 48 std::make_pair(frame_it->first, frame_it->second.size())); | 48 std::make_pair(frame_it->first, frame_it->second.size())); |
| 49 } | 49 } |
| 50 ++frame_it; | 50 ++frame_it; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 SetFrameIds(frame_id, frame_id - 1); | 420 SetFrameIds(frame_id, frame_id - 1); |
| 421 InsertPacket(); | 421 InsertPacket(); |
| 422 testing_clock_.Advance( | 422 testing_clock_.Advance( |
| 423 base::TimeDelta::FromMilliseconds(kShortTimeIncrementMs)); | 423 base::TimeDelta::FromMilliseconds(kShortTimeIncrementMs)); |
| 424 EXPECT_TRUE(feedback_.triggered()); | 424 EXPECT_TRUE(feedback_.triggered()); |
| 425 EXPECT_EQ(frame_id, feedback_.last_frame_acked()); | 425 EXPECT_EQ(frame_id, feedback_.last_frame_acked()); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace cast | 428 } // namespace cast |
| 429 } // namespace media | 429 } // namespace media |
| OLD | NEW |