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

Side by Side Diff: media/cast/audio_sender/audio_sender.cc

Issue 343523005: Cast: Avoid retransmit if we sent the same packet recently (less than RTT) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: store time before send, not after Created 6 years, 6 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
OLDNEW
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/audio_sender/audio_sender.h" 5 #include "media/cast/audio_sender/audio_sender.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/cast/audio_sender/audio_encoder.h" 10 #include "media/cast/audio_sender/audio_encoder.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 frame_id_to_rtp_timestamp_[audio_frame->frame_id & 0xff] = 101 frame_id_to_rtp_timestamp_[audio_frame->frame_id & 0xff] =
102 audio_frame->rtp_timestamp; 102 audio_frame->rtp_timestamp;
103 transport_sender_->InsertCodedAudioFrame(*audio_frame); 103 transport_sender_->InsertCodedAudioFrame(*audio_frame);
104 } 104 }
105 105
106 void AudioSender::ResendPackets( 106 void AudioSender::ResendPackets(
107 const MissingFramesAndPacketsMap& missing_frames_and_packets) { 107 const MissingFramesAndPacketsMap& missing_frames_and_packets) {
108 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 108 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
109 transport_sender_->ResendPackets(true, missing_frames_and_packets, false); 109
110 base::TimeDelta rtt;
111 base::TimeDelta avg_rtt;
112 base::TimeDelta min_rtt;
113 base::TimeDelta max_rtt;
114 rtcp_.Rtt(&rtt, &avg_rtt, &min_rtt, &max_rtt);
115
116 // It would probably be better to use the 10% percentile rtt
117 // rather than the min.
118 transport_sender_->ResendPackets(
119 true, missing_frames_and_packets, false, min_rtt);
Alpha Left Google 2014/06/18 01:43:32 In VideoSender we used rtt and avg_rtt while min_r
hubbe 2014/06/18 20:22:28 Done.
110 } 120 }
111 121
112 void AudioSender::IncomingRtcpPacket(scoped_ptr<Packet> packet) { 122 void AudioSender::IncomingRtcpPacket(scoped_ptr<Packet> packet) {
113 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 123 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
114 rtcp_.IncomingRtcpPacket(&packet->front(), packet->size()); 124 rtcp_.IncomingRtcpPacket(&packet->front(), packet->size());
115 } 125 }
116 126
117 void AudioSender::ScheduleNextRtcpReport() { 127 void AudioSender::ScheduleNextRtcpReport() {
118 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 128 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
119 base::TimeDelta time_to_next = 129 base::TimeDelta time_to_next =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 uint32 acked_frame_id = static_cast<uint32>(cast_feedback.ack_frame_id_); 177 uint32 acked_frame_id = static_cast<uint32>(cast_feedback.ack_frame_id_);
168 VLOG(2) << "Received audio ACK: " << acked_frame_id; 178 VLOG(2) << "Received audio ACK: " << acked_frame_id;
169 cast_environment_->Logging()->InsertFrameEvent( 179 cast_environment_->Logging()->InsertFrameEvent(
170 cast_environment_->Clock()->NowTicks(), 180 cast_environment_->Clock()->NowTicks(),
171 FRAME_ACK_RECEIVED, AUDIO_EVENT, 181 FRAME_ACK_RECEIVED, AUDIO_EVENT,
172 frame_id_to_rtp_timestamp_[acked_frame_id & 0xff], acked_frame_id); 182 frame_id_to_rtp_timestamp_[acked_frame_id & 0xff], acked_frame_id);
173 } 183 }
174 184
175 } // namespace cast 185 } // namespace cast
176 } // namespace media 186 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698