Index: media/cast/sender/frame_sender.cc |
diff --git a/media/cast/sender/frame_sender.cc b/media/cast/sender/frame_sender.cc |
index 44f505e8c26c03e3d9d6864fd5fa2fcc11296c45..1df62fbd5cc870c46c53163b16308c81b0d458c8 100644 |
--- a/media/cast/sender/frame_sender.cc |
+++ b/media/cast/sender/frame_sender.cc |
@@ -4,6 +4,8 @@ |
#include "media/cast/sender/frame_sender.h" |
+#include <limits> |
+ |
#include "base/trace_event/trace_event.h" |
#include "media/cast/cast_defines.h" |
#include "media/cast/constants.h" |
@@ -29,7 +31,7 @@ FrameSender::FrameSender(scoped_refptr<CastEnvironment> cast_environment, |
bool is_audio, |
CastTransportSender* const transport_sender, |
int rtp_timebase, |
- uint32 ssrc, |
+ uint32_t ssrc, |
double max_frame_rate, |
base::TimeDelta min_playout_delay, |
base::TimeDelta max_playout_delay, |
@@ -37,8 +39,9 @@ FrameSender::FrameSender(scoped_refptr<CastEnvironment> cast_environment, |
: cast_environment_(cast_environment), |
transport_sender_(transport_sender), |
ssrc_(ssrc), |
- min_playout_delay_(min_playout_delay == base::TimeDelta() ? |
- max_playout_delay : min_playout_delay), |
+ min_playout_delay_(min_playout_delay == base::TimeDelta() |
+ ? max_playout_delay |
+ : min_playout_delay), |
max_playout_delay_(max_playout_delay), |
send_target_playout_delay_(false), |
max_frame_rate_(max_frame_rate), |
@@ -86,10 +89,10 @@ void FrameSender::SendRtcpReport(bool schedule_future_reports) { |
const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
const base::TimeDelta time_delta = |
now - GetRecordedReferenceTime(last_sent_frame_id_); |
- const int64 rtp_delta = TimeDeltaToRtpDelta(time_delta, rtp_timebase_); |
- const uint32 now_as_rtp_timestamp = |
+ const int64_t rtp_delta = TimeDeltaToRtpDelta(time_delta, rtp_timebase_); |
+ const uint32_t now_as_rtp_timestamp = |
GetRecordedRtpTimestamp(last_sent_frame_id_) + |
- static_cast<uint32>(rtp_delta); |
+ static_cast<uint32_t>(rtp_delta); |
transport_sender_->SendSenderReport(ssrc_, now, now_as_rtp_timestamp); |
if (schedule_future_reports) |
@@ -160,7 +163,7 @@ void FrameSender::ResendForKickstart() { |
transport_sender_->ResendFrameForKickstart(ssrc_, last_sent_frame_id_); |
} |
-void FrameSender::RecordLatestFrameTimestamps(uint32 frame_id, |
+void FrameSender::RecordLatestFrameTimestamps(uint32_t frame_id, |
base::TimeTicks reference_time, |
RtpTimestamp rtp_timestamp) { |
DCHECK(!reference_time.is_null()); |
@@ -170,17 +173,17 @@ void FrameSender::RecordLatestFrameTimestamps(uint32 frame_id, |
rtp_timestamp; |
} |
-base::TimeTicks FrameSender::GetRecordedReferenceTime(uint32 frame_id) const { |
+base::TimeTicks FrameSender::GetRecordedReferenceTime(uint32_t frame_id) const { |
return frame_reference_times_[frame_id % arraysize(frame_reference_times_)]; |
} |
-RtpTimestamp FrameSender::GetRecordedRtpTimestamp(uint32 frame_id) const { |
+RtpTimestamp FrameSender::GetRecordedRtpTimestamp(uint32_t frame_id) const { |
return frame_rtp_timestamps_[frame_id % arraysize(frame_rtp_timestamps_)]; |
} |
int FrameSender::GetUnacknowledgedFrameCount() const { |
const int count = |
- static_cast<int32>(last_sent_frame_id_ - latest_acked_frame_id_); |
+ static_cast<int32_t>(last_sent_frame_id_ - latest_acked_frame_id_); |
DCHECK_GE(count, 0); |
return count; |
} |
@@ -201,7 +204,7 @@ void FrameSender::SendEncodedFrame( |
VLOG(2) << SENDER_SSRC << "About to send another frame: last_sent=" |
<< last_sent_frame_id_ << ", latest_acked=" << latest_acked_frame_id_; |
- const uint32 frame_id = encoded_frame->frame_id; |
+ const uint32_t frame_id = encoded_frame->frame_id; |
const bool is_first_frame_to_be_sent = last_send_time_.is_null(); |
last_send_time_ = cast_environment_->Clock()->NowTicks(); |
@@ -335,8 +338,8 @@ void FrameSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) { |
cast_environment_->logger()->DispatchFrameEvent(ack_event.Pass()); |
const bool is_acked_out_of_order = |
- static_cast<int32>(cast_feedback.ack_frame_id - |
- latest_acked_frame_id_) < 0; |
+ static_cast<int32_t>(cast_feedback.ack_frame_id - |
+ latest_acked_frame_id_) < 0; |
VLOG(2) << SENDER_SSRC |
<< "Received ACK" << (is_acked_out_of_order ? " out-of-order" : "") |
<< " for frame " << cast_feedback.ack_frame_id; |
@@ -347,7 +350,7 @@ void FrameSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) { |
"latest_acked_frame_id", latest_acked_frame_id_); |
} else { |
// Cancel resends of acked frames. |
- std::vector<uint32> cancel_sending_frames; |
+ std::vector<uint32_t> cancel_sending_frames; |
while (latest_acked_frame_id_ != cast_feedback.ack_frame_id) { |
latest_acked_frame_id_++; |
cancel_sending_frames.push_back(latest_acked_frame_id_); |
@@ -390,8 +393,10 @@ bool FrameSender::ShouldDropNextFrame(base::TimeDelta frame_duration) const { |
duration_in_flight + frame_duration; |
const base::TimeDelta allowed_in_flight = GetAllowedInFlightMediaDuration(); |
if (VLOG_IS_ON(1)) { |
- const int64 percent = allowed_in_flight > base::TimeDelta() ? |
- 100 * duration_would_be_in_flight / allowed_in_flight : kint64max; |
+ const int64_t percent = |
+ allowed_in_flight > base::TimeDelta() |
+ ? 100 * duration_would_be_in_flight / allowed_in_flight |
+ : std::numeric_limits<int64_t>::max(); |
VLOG_IF(1, percent > 50) |
<< SENDER_SSRC |
<< duration_in_flight.InMicroseconds() << " usec in-flight + " |