Chromium Code Reviews| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 } | 114 } |
| 115 | 115 |
| 116 void RtpSender::RtpStatistics(const base::TimeTicks& now, | 116 void RtpSender::RtpStatistics(const base::TimeTicks& now, |
| 117 RtcpSenderInfo* sender_info) { | 117 RtcpSenderInfo* sender_info) { |
| 118 // The timestamp of this Rtcp packet should be estimated as the timestamp of | 118 // The timestamp of this Rtcp packet should be estimated as the timestamp of |
| 119 // the frame being captured at this moment. We are calculating that | 119 // the frame being captured at this moment. We are calculating that |
| 120 // timestamp as the last frame's timestamp + the time since the last frame | 120 // timestamp as the last frame's timestamp + the time since the last frame |
| 121 // was captured. | 121 // was captured. |
| 122 uint32 ntp_seconds = 0; | 122 uint32 ntp_seconds = 0; |
| 123 uint32 ntp_fraction = 0; | 123 uint32 ntp_fraction = 0; |
| 124 ConvertTimeToNtp(now, &ntp_seconds, &ntp_fraction); | 124 ConvertTimeToFractions((now - base::TimeTicks()).InMicroseconds(), |
|
miu
2013/10/30 19:33:35
I'm confused: Did you mean to change this, or was
pwestin
2013/10/30 23:14:30
Yes you are correct, good catch
| |
| 125 &ntp_seconds, &ntp_fraction); | |
| 125 sender_info->ntp_seconds = ntp_seconds; | 126 sender_info->ntp_seconds = ntp_seconds; |
| 126 sender_info->ntp_fraction = ntp_fraction; | 127 sender_info->ntp_fraction = ntp_fraction; |
| 127 | 128 |
| 128 base::TimeTicks time_sent; | 129 base::TimeTicks time_sent; |
| 129 uint32 rtp_timestamp; | 130 uint32 rtp_timestamp; |
| 130 if (packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp)) { | 131 if (packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp)) { |
| 131 base::TimeDelta time_since_last_send = now - time_sent; | 132 base::TimeDelta time_since_last_send = now - time_sent; |
| 132 sender_info->rtp_timestamp = rtp_timestamp + | 133 sender_info->rtp_timestamp = rtp_timestamp + |
| 133 time_since_last_send.InMilliseconds() * (config_.frequency / 1000); | 134 time_since_last_send.InMilliseconds() * (config_.frequency / 1000); |
| 134 } else { | 135 } else { |
| 135 sender_info->rtp_timestamp = 0; | 136 sender_info->rtp_timestamp = 0; |
| 136 } | 137 } |
| 137 sender_info->send_packet_count = packetizer_->send_packets_count(); | 138 sender_info->send_packet_count = packetizer_->send_packets_count(); |
| 138 sender_info->send_octet_count = packetizer_->send_octet_count(); | 139 sender_info->send_octet_count = packetizer_->send_octet_count(); |
| 139 } | 140 } |
| 140 | 141 |
| 141 } // namespace cast | 142 } // namespace cast |
| 142 } // namespace media | 143 } // namespace media |
| OLD | NEW |