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/transport/rtp_sender/rtp_sender.h" | 5 #include "media/cast/transport/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/transport/cast_transport_defines.h" | 9 #include "media/cast/transport/cast_transport_defines.h" |
10 #include "media/cast/transport/pacing/paced_sender.h" | 10 #include "media/cast/transport/pacing/paced_sender.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 void RtpSender::SubscribeRtpStatsCallback( | 128 void RtpSender::SubscribeRtpStatsCallback( |
129 const CastTransportRtpStatistics& callback) { | 129 const CastTransportRtpStatistics& callback) { |
130 stats_callback_ = callback; | 130 stats_callback_ = callback; |
131 ScheduleNextStatsReport(); | 131 ScheduleNextStatsReport(); |
132 } | 132 } |
133 | 133 |
134 void RtpSender::ScheduleNextStatsReport() { | 134 void RtpSender::ScheduleNextStatsReport() { |
135 transport_task_runner_->PostDelayedTask( | 135 transport_task_runner_->PostDelayedTask( |
136 FROM_HERE, | 136 FROM_HERE, |
137 base::Bind(&RtpSender::RtpStatistics, base::Unretained(this)), | 137 base::Bind(&RtpSender::RtpStatistics, base::AsWeakPtr(this)), |
138 base::TimeDelta::FromMilliseconds(kStatsCallbackIntervalMs)); | 138 base::TimeDelta::FromMilliseconds(kStatsCallbackIntervalMs)); |
139 } | 139 } |
140 | 140 |
141 void RtpSender::RtpStatistics() { | 141 void RtpSender::RtpStatistics() { |
142 RtcpSenderInfo sender_info; | 142 RtcpSenderInfo sender_info; |
143 base::TimeTicks time_sent; | 143 base::TimeTicks time_sent; |
144 uint32 rtp_timestamp = 0; | 144 uint32 rtp_timestamp = 0; |
145 packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp); | 145 packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp); |
146 sender_info.send_packet_count = packetizer_->send_packets_count(); | 146 sender_info.send_packet_count = packetizer_->send_packets_count(); |
147 sender_info.send_octet_count = packetizer_->send_octet_count(); | 147 sender_info.send_octet_count = packetizer_->send_octet_count(); |
148 stats_callback_.Run(sender_info, time_sent, rtp_timestamp); | 148 stats_callback_.Run(sender_info, time_sent, rtp_timestamp); |
149 ScheduleNextStatsReport(); | 149 ScheduleNextStatsReport(); |
150 } | 150 } |
151 | 151 |
152 } // namespace transport | 152 } // namespace transport |
153 } // namespace cast | 153 } // namespace cast |
154 } // namespace media | 154 } // namespace media |
OLD | NEW |