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

Side by Side Diff: media/cast/net/rtp/rtp_sender.cc

Issue 445933002: Cast: Move retransmission to the transport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed test compile Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/cast/net/rtp/rtp_sender.h ('k') | media/cast/sender/audio_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/cast/net/rtp/rtp_sender.h" 5 #include "media/cast/net/rtp/rtp_sender.h"
6 6
7 #include "base/big_endian.h" 7 #include "base/big_endian.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "media/cast/net/cast_transport_defines.h" 10 #include "media/cast/net/cast_transport_defines.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 UpdateSequenceNumber(&packet_copy->data); 110 UpdateSequenceNumber(&packet_copy->data);
111 packets_to_resend.push_back(std::make_pair(packet_key, packet_copy)); 111 packets_to_resend.push_back(std::make_pair(packet_key, packet_copy));
112 } else if (cancel_rtx_if_not_in_list) { 112 } else if (cancel_rtx_if_not_in_list) {
113 transport_->CancelSendingPacket(it->first); 113 transport_->CancelSendingPacket(it->first);
114 } 114 }
115 } 115 }
116 transport_->ResendPackets(packets_to_resend, dedupe_window); 116 transport_->ResendPackets(packets_to_resend, dedupe_window);
117 } 117 }
118 } 118 }
119 119
120 void RtpSender::CancelSendingFrames(const std::vector<uint32>& frame_ids) {
121 for (std::vector<uint32>::const_iterator i = frame_ids.begin();
122 i != frame_ids.end(); ++i) {
123 const SendPacketVector* stored_packets = storage_->GetFrame8(*i & 0xFF);
124 if (!stored_packets)
125 continue;
126 for (SendPacketVector::const_iterator j = stored_packets->begin();
127 j != stored_packets->end(); ++j) {
128 transport_->CancelSendingPacket(j->first);
129 }
130 }
131 }
132
133 void RtpSender::ResendFrameForKickstart(uint32 frame_id,
134 base::TimeDelta dedupe_window) {
135 // Send the last packet of the encoded frame to kick start
136 // retransmission. This gives enough information to the receiver what
137 // packets and frames are missing.
138 MissingFramesAndPacketsMap missing_frames_and_packets;
139 PacketIdSet missing;
140 missing.insert(kRtcpCastLastPacket);
141 missing_frames_and_packets.insert(std::make_pair(frame_id, missing));
142
143 // Sending this extra packet is to kick-start the session. There is
144 // no need to optimize re-transmission for this case.
145 ResendPackets(missing_frames_and_packets, false, dedupe_window);
146 }
147
120 void RtpSender::UpdateSequenceNumber(Packet* packet) { 148 void RtpSender::UpdateSequenceNumber(Packet* packet) {
121 // TODO(miu): This is an abstraction violation. This needs to be a part of 149 // TODO(miu): This is an abstraction violation. This needs to be a part of
122 // the overall packet (de)serialization consolidation. 150 // the overall packet (de)serialization consolidation.
123 static const int kByteOffsetToSequenceNumber = 2; 151 static const int kByteOffsetToSequenceNumber = 2;
124 base::BigEndianWriter big_endian_writer( 152 base::BigEndianWriter big_endian_writer(
125 reinterpret_cast<char*>((&packet->front()) + kByteOffsetToSequenceNumber), 153 reinterpret_cast<char*>((&packet->front()) + kByteOffsetToSequenceNumber),
126 sizeof(uint16)); 154 sizeof(uint16));
127 big_endian_writer.WriteU16(packetizer_->NextSequenceNumber()); 155 big_endian_writer.WriteU16(packetizer_->NextSequenceNumber());
128 } 156 }
129 157
130 } // namespace cast 158 } // namespace cast
131 } // namespace media 159 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/rtp/rtp_sender.h ('k') | media/cast/sender/audio_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698