Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: media/cast/transport/rtp_sender/rtp_sender.cc

Issue 302913004: Cast: cancel re-sending if a later nack packet says the receiver doesn't want it anymore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: variable renamed + comment added Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/transport/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/transport/rtp_sender/rtp_sender.cc
diff --git a/media/cast/transport/rtp_sender/rtp_sender.cc b/media/cast/transport/rtp_sender/rtp_sender.cc
index 735d086694ca702e01728525b911c83c24596b8a..91b6298bac5d94e4b6e5d9f94255e4c20d402b36 100644
--- a/media/cast/transport/rtp_sender/rtp_sender.cc
+++ b/media/cast/transport/rtp_sender/rtp_sender.cc
@@ -70,51 +70,32 @@ void RtpSender::ResendPackets(
++it) {
SendPacketVector packets_to_resend;
uint8 frame_id = it->first;
- const PacketIdSet& packets_set = it->second;
+ // Set of packets that the receiver wants us to re-send.
+ // If empty, we need to re-send all packets for this frame.
+ const PacketIdSet& missing_packet_set = it->second;
bool success = false;
- if (packets_set.empty()) {
- VLOG(3) << "Missing all packets in frame " << static_cast<int>(frame_id);
+ for (uint16 packet_id = 0; ; packet_id++) {
+ // Get packet from storage.
+ success = storage_->GetPacket(frame_id, packet_id, &packets_to_resend);
- uint16 packet_id = 0;
- do {
- // Get packet from storage.
- success = storage_->GetPacket(frame_id, packet_id, &packets_to_resend);
+ // Check that we got at least one packet.
+ DCHECK(packet_id != 0 || success)
+ << "Failed to resend frame " << static_cast<int>(frame_id);
- // Check that we got at least one packet.
- DCHECK(packet_id != 0 || success)
- << "Failed to resend frame " << static_cast<int>(frame_id);
+ if (!success) break;
+ if (!missing_packet_set.empty() &&
+ missing_packet_set.find(packet_id) == missing_packet_set.end()) {
+ transport_->CancelSendingPacket(packets_to_resend.back().first);
+ packets_to_resend.pop_back();
+ } else {
// Resend packet to the network.
- if (success) {
- VLOG(3) << "Resend " << static_cast<int>(frame_id) << ":"
- << packet_id;
- // Set a unique incremental sequence number for every packet.
- PacketRef packet = packets_to_resend.back().second;
- UpdateSequenceNumber(&packet->data);
- // Set the size as correspond to each frame.
- ++packet_id;
- }
- } while (success);
- } else {
- // Iterate over all of the packets in the frame.
- for (PacketIdSet::const_iterator set_it = packets_set.begin();
- set_it != packets_set.end();
- ++set_it) {
- uint16 packet_id = *set_it;
- success = storage_->GetPacket(frame_id, packet_id, &packets_to_resend);
-
- // Check that we got at least one packet.
- DCHECK(set_it != packets_set.begin() || success)
- << "Failed to resend frame " << frame_id;
-
- // Resend packet to the network.
- if (success) {
- VLOG(3) << "Resend " << static_cast<int>(frame_id) << ":"
- << packet_id;
- PacketRef packet = packets_to_resend.back().second;
- UpdateSequenceNumber(&packet->data);
- }
+ VLOG(3) << "Resend " << static_cast<int>(frame_id) << ":"
+ << packet_id;
+ // Set a unique incremental sequence number for every packet.
+ PacketRef packet = packets_to_resend.back().second;
+ UpdateSequenceNumber(&packet->data);
}
}
transport_->ResendPackets(packets_to_resend);
« no previous file with comments | « media/cast/transport/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698