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/rtp_sender/rtp_sender.h" | 5 #include "media/cast/rtp_sender/rtp_sender.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "media/cast/cast_defines.h" | 9 #include "media/cast/cast_defines.h" |
10 #include "media/cast/pacing/paced_sender.h" | 10 #include "media/cast/pacing/paced_sender.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 packet.clear(); | 76 packet.clear(); |
77 success = storage_->GetPacket(frame_id, packet_id, &packet); | 77 success = storage_->GetPacket(frame_id, packet_id, &packet); |
78 | 78 |
79 // Resend packet to the network. | 79 // Resend packet to the network. |
80 if (success) { | 80 if (success) { |
81 VLOG(1) << "Resend " << static_cast<int>(frame_id) << ":" | 81 VLOG(1) << "Resend " << static_cast<int>(frame_id) << ":" |
82 << packet_id << " size: " << packets.size(); | 82 << packet_id << " size: " << packets.size(); |
83 // Set a unique incremental sequence number for every packet. | 83 // Set a unique incremental sequence number for every packet. |
84 UpdateSequenceNumber(&packet); | 84 UpdateSequenceNumber(&packet); |
85 // Set the size as correspond to each frame. | 85 // Set the size as correspond to each frame. |
86 transport_->ResendPacket(packet, packets.size()); | 86 transport_->ResendPacket(packet, static_cast<int>(packets.size())); |
87 ++packet_id; | 87 ++packet_id; |
88 } | 88 } |
89 } while (success); | 89 } while (success); |
90 | 90 |
91 } else { | 91 } else { |
92 for (std::set<uint16>::const_iterator set_it = packets.begin(); | 92 for (std::set<uint16>::const_iterator set_it = packets.begin(); |
93 set_it != packets.end(); ++set_it) { | 93 set_it != packets.end(); ++set_it) { |
94 uint16 packet_id = *set_it; | 94 uint16 packet_id = *set_it; |
95 // Get packet from storage. | 95 // Get packet from storage. |
96 packet.clear(); | 96 packet.clear(); |
97 bool success = storage_->GetPacket(frame_id, packet_id, &packet); | 97 bool success = storage_->GetPacket(frame_id, packet_id, &packet); |
98 // Resend packet to the network. | 98 // Resend packet to the network. |
99 if (success) { | 99 if (success) { |
100 VLOG(1) << "Resend " << static_cast<int>(frame_id) << ":" | 100 VLOG(1) << "Resend " << static_cast<int>(frame_id) << ":" |
101 << packet_id << " size: " << packet.size(); | 101 << packet_id << " size: " << packet.size(); |
102 UpdateSequenceNumber(&packet); | 102 UpdateSequenceNumber(&packet); |
103 // Set the size as correspond to each frame. | 103 // Set the size as correspond to each frame. |
104 transport_->ResendPacket(packet, packets.size()); | 104 transport_->ResendPacket(packet, static_cast<int>(packets.size())); |
105 } else { | 105 } else { |
106 VLOG(1) << "Failed to resend " << static_cast<int>(frame_id) << ":" | 106 VLOG(1) << "Failed to resend " << static_cast<int>(frame_id) << ":" |
107 << packet_id; | 107 << packet_id; |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 void RtpSender::UpdateSequenceNumber(std::vector<uint8>* packet) { | 114 void RtpSender::UpdateSequenceNumber(std::vector<uint8>* packet) { |
(...skipping 23 matching lines...) Expand all Loading... |
138 time_since_last_send.InMilliseconds() * (config_.frequency / 1000); | 138 time_since_last_send.InMilliseconds() * (config_.frequency / 1000); |
139 } else { | 139 } else { |
140 sender_info->rtp_timestamp = 0; | 140 sender_info->rtp_timestamp = 0; |
141 } | 141 } |
142 sender_info->send_packet_count = packetizer_->send_packets_count(); | 142 sender_info->send_packet_count = packetizer_->send_packets_count(); |
143 sender_info->send_octet_count = packetizer_->send_octet_count(); | 143 sender_info->send_octet_count = packetizer_->send_octet_count(); |
144 } | 144 } |
145 | 145 |
146 } // namespace cast | 146 } // namespace cast |
147 } // namespace media | 147 } // namespace media |
OLD | NEW |