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 "media/cast/rtcp/rtcp_sender.h" | 5 #include "media/cast/rtcp/rtcp_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 big_endian_writer.WriteU8(cast->ack_frame_id_); | 483 big_endian_writer.WriteU8(cast->ack_frame_id_); |
484 int cast_loss_field_pos = | 484 int cast_loss_field_pos = |
485 static_cast<int>(start_size) + 17; // Save loss field position. | 485 static_cast<int>(start_size) + 17; // Save loss field position. |
486 big_endian_writer.WriteU8(0); // Overwritten with number_of_loss_fields. | 486 big_endian_writer.WriteU8(0); // Overwritten with number_of_loss_fields. |
487 big_endian_writer.WriteU8(0); // Reserved. | 487 big_endian_writer.WriteU8(0); // Reserved. |
488 big_endian_writer.WriteU8(0); // Reserved. | 488 big_endian_writer.WriteU8(0); // Reserved. |
489 | 489 |
490 int number_of_loss_fields = 0; | 490 int number_of_loss_fields = 0; |
491 int max_number_of_loss_fields = | 491 int max_number_of_loss_fields = |
492 std::min<int>(kRtcpMaxCastLossFields, | 492 std::min<int>(kRtcpMaxCastLossFields, |
493 kIpPacketSize - static_cast<int>(packet->size()) / 4); | 493 (kIpPacketSize - static_cast<int>(packet->size())) / 4); |
494 | 494 |
495 std::map<uint8, std::set<uint16> >::const_iterator frame_it = | 495 std::map<uint8, std::set<uint16> >::const_iterator frame_it = |
496 cast->missing_frames_and_packets_.begin(); | 496 cast->missing_frames_and_packets_.begin(); |
497 | 497 |
498 for (; frame_it != cast->missing_frames_and_packets_.end() && | 498 for (; frame_it != cast->missing_frames_and_packets_.end() && |
499 number_of_loss_fields < max_number_of_loss_fields; ++frame_it) { | 499 number_of_loss_fields < max_number_of_loss_fields; ++frame_it) { |
500 // Iterate through all frames with missing packets. | 500 // Iterate through all frames with missing packets. |
501 if (frame_it->second.empty()) { | 501 if (frame_it->second.empty()) { |
502 // Special case all packets in a frame is missing. | 502 // Special case all packets in a frame is missing. |
503 start_size = packet->size(); | 503 start_size = packet->size(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 (*packet)[cast_size_pos] = static_cast<uint8>(4 + number_of_loss_fields); | 540 (*packet)[cast_size_pos] = static_cast<uint8>(4 + number_of_loss_fields); |
541 (*packet)[cast_loss_field_pos] = static_cast<uint8>(number_of_loss_fields); | 541 (*packet)[cast_loss_field_pos] = static_cast<uint8>(number_of_loss_fields); |
542 | 542 |
543 // Frames with missing packets. | 543 // Frames with missing packets. |
544 TRACE_COUNTER_ID1("cast_rtcp", "RtcpSender::CastNACK", ssrc_, | 544 TRACE_COUNTER_ID1("cast_rtcp", "RtcpSender::CastNACK", ssrc_, |
545 cast->missing_frames_and_packets_.size()); | 545 cast->missing_frames_and_packets_.size()); |
546 } | 546 } |
547 | 547 |
548 } // namespace cast | 548 } // namespace cast |
549 } // namespace media | 549 } // namespace media |
OLD | NEW |