diff options
Diffstat (limited to 'media/cast/net/rtcp')
-rw-r--r-- | media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc | 7 | ||||
-rw-r--r-- | media/cast/net/rtcp/receiver_rtcp_event_subscriber.h | 6 | ||||
-rw-r--r-- | media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc | 4 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp.h | 6 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_builder.cc | 53 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_builder.h | 4 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_builder_unittest.cc | 32 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_defines.cc | 4 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_defines.h | 38 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_unittest.cc | 28 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_utility.cc | 79 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_utility.h | 30 | ||||
-rw-r--r-- | media/cast/net/rtcp/rtcp_utility_unittest.cc | 18 | ||||
-rw-r--r-- | media/cast/net/rtcp/test_rtcp_packet_builder.cc | 54 | ||||
-rw-r--r-- | media/cast/net/rtcp/test_rtcp_packet_builder.h | 64 |
15 files changed, 211 insertions, 216 deletions
diff --git a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc index 6ada1e4..7935e67 100644 --- a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc +++ b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc @@ -81,7 +81,7 @@ void ReceiverRtcpEventSubscriber::GetRtcpEventsWithRedundancy( DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(rtcp_events); - uint64 event_level = rtcp_events_.size() + popped_events_; + uint64_t event_level = rtcp_events_.size() + popped_events_; event_levels_for_past_frames_.push_back(event_level); for (size_t i = 0; i < kNumResends; i++) { @@ -89,8 +89,9 @@ void ReceiverRtcpEventSubscriber::GetRtcpEventsWithRedundancy( if (event_levels_for_past_frames_.size() < resend_delay + 1) break; - uint64 send_limit = event_levels_for_past_frames_[ - event_levels_for_past_frames_.size() - 1 - resend_delay]; + uint64_t send_limit = + event_levels_for_past_frames_[event_levels_for_past_frames_.size() - 1 - + resend_delay]; if (send_ptrs_[i] < popped_events_) { send_ptrs_[i] = popped_events_; diff --git a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h index 248f07a..54ee477 100644 --- a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h +++ b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h @@ -74,21 +74,21 @@ class ReceiverRtcpEventSubscriber : public RawEventSubscriber { std::deque<RtcpEventPair> rtcp_events_; // Counts how many events have been removed from rtcp_events_. - uint64 popped_events_; + uint64_t popped_events_; // Events greater than send_ptrs_[0] have not been sent yet. // Events greater than send_ptrs_[1] have been transmit once. // Note that these counters use absolute numbers, so you need // to subtract popped_events_ before looking up the events in // rtcp_events_. - uint64 send_ptrs_[kNumResends]; + uint64_t send_ptrs_[kNumResends]; // For each frame, we push how many events have been added to // rtcp_events_ so far. We use this to make sure that // send_ptrs_[N+1] is always at least kResendDelay frames behind // send_ptrs_[N]. Old information is removed so that information // for (kNumResends + 1) * kResendDelay frames remain. - std::deque<uint64> event_levels_for_past_frames_; + std::deque<uint64_t> event_levels_for_past_frames_; // Ensures methods are only called on the main thread. base::ThreadChecker thread_checker_; diff --git a/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc b/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc index 4980494..7797da3 100644 --- a/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc +++ b/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc @@ -18,7 +18,7 @@ namespace cast { namespace { const size_t kMaxEventEntries = 10u; -const int64 kDelayMs = 20L; +const int64_t kDelayMs = 20L; } // namespace @@ -152,7 +152,7 @@ TEST_F(ReceiverRtcpEventSubscriberTest, LogAudioEvents) { TEST_F(ReceiverRtcpEventSubscriberTest, DropEventsWhenSizeExceeded) { Init(VIDEO_EVENT); - for (uint32 i = 1u; i <= 10u; ++i) { + for (uint32_t i = 1u; i <= 10u; ++i) { scoped_ptr<FrameEvent> decode_event(new FrameEvent()); decode_event->timestamp = testing_clock_->NowTicks(); decode_event->type = FRAME_DECODED; diff --git a/media/cast/net/rtcp/rtcp.h b/media/cast/net/rtcp/rtcp.h index 48c6f0d..4780a9f 100644 --- a/media/cast/net/rtcp/rtcp.h +++ b/media/cast/net/rtcp/rtcp.h @@ -85,7 +85,7 @@ class Rtcp { // and used to maintain a RTCP session. // Returns false if this is not a RTCP packet or it is not directed to // this session, e.g. SSRC doesn't match. - bool IncomingRtcpPacket(const uint8* data, size_t length); + bool IncomingRtcpPacket(const uint8_t* data, size_t length); // If available, returns true and sets the output arguments to the latest // lip-sync timestamps gleaned from the sender reports. While the sender @@ -102,8 +102,8 @@ class Rtcp { return current_round_trip_time_; } - static bool IsRtcpPacket(const uint8* packet, size_t length); - static uint32_t GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); + static bool IsRtcpPacket(const uint8_t* packet, size_t length); + static uint32_t GetSsrcOfSender(const uint8_t* rtcp_buffer, size_t length); uint32_t GetLocalSsrc() const { return local_ssrc_; } uint32_t GetRemoteSsrc() const { return remote_ssrc_; } diff --git a/media/cast/net/rtcp/rtcp_builder.cc b/media/cast/net/rtcp/rtcp_builder.cc index 07006fc..1f81520 100644 --- a/media/cast/net/rtcp/rtcp_builder.cc +++ b/media/cast/net/rtcp/rtcp_builder.cc @@ -18,20 +18,20 @@ namespace { // Max delta is 4095 milliseconds because we need to be able to encode it in // 12 bits. -const int64 kMaxWireFormatTimeDeltaMs = INT64_C(0xfff); +const int64_t kMaxWireFormatTimeDeltaMs = INT64_C(0xfff); -uint16 MergeEventTypeAndTimestampForWireFormat( +uint16_t MergeEventTypeAndTimestampForWireFormat( const CastLoggingEvent& event, const base::TimeDelta& time_delta) { - int64 time_delta_ms = time_delta.InMilliseconds(); + int64_t time_delta_ms = time_delta.InMilliseconds(); DCHECK_GE(time_delta_ms, 0); DCHECK_LE(time_delta_ms, kMaxWireFormatTimeDeltaMs); - uint16 time_delta_12_bits = - static_cast<uint16>(time_delta_ms & kMaxWireFormatTimeDeltaMs); + uint16_t time_delta_12_bits = + static_cast<uint16_t>(time_delta_ms & kMaxWireFormatTimeDeltaMs); - uint16 event_type_4_bits = ConvertEventTypeToWireFormat(event); + uint16_t event_type_4_bits = ConvertEventTypeToWireFormat(event); DCHECK(event_type_4_bits); DCHECK(~(event_type_4_bits & 0xfff0)); return (event_type_4_bits << 12) | time_delta_12_bits; @@ -114,11 +114,8 @@ class NackStringBuilder { }; } // namespace -RtcpBuilder::RtcpBuilder(uint32 sending_ssrc) - : writer_(NULL, 0), - ssrc_(sending_ssrc), - ptr_of_length_(NULL) { -} +RtcpBuilder::RtcpBuilder(uint32_t sending_ssrc) + : writer_(NULL, 0), ssrc_(sending_ssrc), ptr_of_length_(NULL) {} RtcpBuilder::~RtcpBuilder() {} @@ -237,8 +234,8 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, writer_.WriteU32(ssrc_); // Add our own SSRC. writer_.WriteU32(cast->media_ssrc); // Remote SSRC. writer_.WriteU32(kCast); - writer_.WriteU8(static_cast<uint8>(cast->ack_frame_id)); - uint8* cast_loss_field_pos = reinterpret_cast<uint8*>(writer_.ptr()); + writer_.WriteU8(static_cast<uint8_t>(cast->ack_frame_id)); + uint8_t* cast_loss_field_pos = reinterpret_cast<uint8_t*>(writer_.ptr()); writer_.WriteU8(0); // Overwritten with number_of_loss_fields. DCHECK_LE(target_delay.InMilliseconds(), std::numeric_limits<uint16_t>::max()); @@ -259,7 +256,7 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, // Iterate through all frames with missing packets. if (frame_it->second.empty()) { // Special case all packets in a frame is missing. - writer_.WriteU8(static_cast<uint8>(frame_it->first)); + writer_.WriteU8(static_cast<uint8_t>(frame_it->first)); writer_.WriteU16(kRtcpCastAllPacketsLost); writer_.WriteU8(0); nack_string_builder.PushPacket(kRtcpCastAllPacketsLost); @@ -267,16 +264,16 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, } else { PacketIdSet::const_iterator packet_it = frame_it->second.begin(); while (packet_it != frame_it->second.end()) { - uint16 packet_id = *packet_it; + uint16_t packet_id = *packet_it; // Write frame and packet id to buffer before calculating bitmask. - writer_.WriteU8(static_cast<uint8>(frame_it->first)); + writer_.WriteU8(static_cast<uint8_t>(frame_it->first)); writer_.WriteU16(packet_id); nack_string_builder.PushPacket(packet_id); - uint8 bitmask = 0; + uint8_t bitmask = 0; ++packet_it; while (packet_it != frame_it->second.end()) { - int shift = static_cast<uint8>(*packet_it - packet_id) - 1; + int shift = static_cast<uint8_t>(*packet_it - packet_id) - 1; if (shift >= 0 && shift <= 7) { nack_string_builder.PushPacket(*packet_it); bitmask |= (1 << shift); @@ -295,7 +292,7 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, << ", ACK: " << cast->ack_frame_id << ", NACK: " << nack_string_builder.GetString(); DCHECK_LE(number_of_loss_fields, kRtcpMaxCastLossFields); - *cast_loss_field_pos = static_cast<uint8>(number_of_loss_fields); + *cast_loss_field_pos = static_cast<uint8_t>(number_of_loss_fields); } void RtcpBuilder::AddSR(const RtcpSenderInfo& sender_info) { @@ -305,7 +302,7 @@ void RtcpBuilder::AddSR(const RtcpSenderInfo& sender_info) { writer_.WriteU32(sender_info.ntp_fraction); writer_.WriteU32(sender_info.rtp_timestamp); writer_.WriteU32(sender_info.send_packet_count); - writer_.WriteU32(static_cast<uint32>(sender_info.send_octet_count)); + writer_.WriteU32(static_cast<uint32_t>(sender_info.send_octet_count)); } /* @@ -367,21 +364,21 @@ void RtcpBuilder::AddReceiverLog( total_number_of_messages_to_send -= messages_in_frame; // On the wire format is number of messages - 1. - writer_.WriteU8(static_cast<uint8>(messages_in_frame - 1)); + writer_.WriteU8(static_cast<uint8_t>(messages_in_frame - 1)); base::TimeTicks event_timestamp_base = frame_log_messages.event_log_messages_.front().event_timestamp; - uint32 base_timestamp_ms = + uint32_t base_timestamp_ms = (event_timestamp_base - base::TimeTicks()).InMilliseconds(); - writer_.WriteU8(static_cast<uint8>(base_timestamp_ms >> 16)); - writer_.WriteU8(static_cast<uint8>(base_timestamp_ms >> 8)); - writer_.WriteU8(static_cast<uint8>(base_timestamp_ms)); + writer_.WriteU8(static_cast<uint8_t>(base_timestamp_ms >> 16)); + writer_.WriteU8(static_cast<uint8_t>(base_timestamp_ms >> 8)); + writer_.WriteU8(static_cast<uint8_t>(base_timestamp_ms)); while (!frame_log_messages.event_log_messages_.empty() && messages_in_frame > 0) { const RtcpReceiverEventLogMessage& event_message = frame_log_messages.event_log_messages_.front(); - uint16 event_type_and_timestamp_delta = + uint16_t event_type_and_timestamp_delta = MergeEventTypeAndTimestampForWireFormat( event_message.type, event_message.event_timestamp - event_timestamp_base); @@ -389,8 +386,8 @@ void RtcpBuilder::AddReceiverLog( case FRAME_ACK_SENT: case FRAME_PLAYOUT: case FRAME_DECODED: - writer_.WriteU16( - static_cast<uint16>(event_message.delay_delta.InMilliseconds())); + writer_.WriteU16(static_cast<uint16_t>( + event_message.delay_delta.InMilliseconds())); writer_.WriteU16(event_type_and_timestamp_delta); break; case PACKET_RECEIVED: diff --git a/media/cast/net/rtcp/rtcp_builder.h b/media/cast/net/rtcp/rtcp_builder.h index e6890d2..c7470a3 100644 --- a/media/cast/net/rtcp/rtcp_builder.h +++ b/media/cast/net/rtcp/rtcp_builder.h @@ -20,7 +20,7 @@ namespace cast { class RtcpBuilder { public: - explicit RtcpBuilder(uint32 sending_ssrc); + explicit RtcpBuilder(uint32_t sending_ssrc); ~RtcpBuilder(); PacketRef BuildRtcpFromReceiver( @@ -54,7 +54,7 @@ class RtcpBuilder { PacketRef Finish(); base::BigEndianWriter writer_; - const uint32 ssrc_; + const uint32_t ssrc_; char* ptr_of_length_; PacketRef packet_; diff --git a/media/cast/net/rtcp/rtcp_builder_unittest.cc b/media/cast/net/rtcp/rtcp_builder_unittest.cc index f39c82d..3ed5294 100644 --- a/media/cast/net/rtcp/rtcp_builder_unittest.cc +++ b/media/cast/net/rtcp/rtcp_builder_unittest.cc @@ -18,8 +18,8 @@ namespace media { namespace cast { namespace { -static const uint32 kSendingSsrc = 0x12345678; -static const uint32 kMediaSsrc = 0x87654321; +static const uint32_t kSendingSsrc = 0x12345678; +static const uint32_t kMediaSsrc = 0x87654321; static const base::TimeDelta kDefaultDelay = base::TimeDelta::FromMilliseconds(100); @@ -167,8 +167,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithRrtraAndCastMessage) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithRrtrCastMessageAndLog) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -242,8 +242,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithRrtrCastMessageAndLog) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOversizedFrameLog) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -264,10 +264,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOversizedFrameLog) { num_events, kTimeBaseMs); for (int i = 0; i < num_events; i++) { - p.AddReceiverEventLog( - kLostPacketId1, - PACKET_RECEIVED, - static_cast<uint16>(kTimeDelayMs * i)); + p.AddReceiverEventLog(kLostPacketId1, PACKET_RECEIVED, + static_cast<uint16_t>(kTimeDelayMs * i)); } @@ -297,8 +295,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOversizedFrameLog) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithTooManyLogFrames) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -343,7 +341,7 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithTooManyLogFrames) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOldLogFrames) { - static const uint32 kTimeBaseMs = 12345678; + static const uint32_t kTimeBaseMs = 12345678; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -390,7 +388,7 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOldLogFrames) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportRedundancy) { - uint32 time_base_ms = 12345678; + uint32_t time_base_ms = 12345678; int kTimeBetweenEventsMs = 10; RtcpReportBlock report_block = GetReportBlock(); @@ -413,9 +411,9 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportRedundancy) { time_base_ms - (num_events - 1) * kResendDelay * kTimeBetweenEventsMs); for (int i = 0; i < num_events; i++) { - p.AddReceiverEventLog( - 0, FRAME_ACK_SENT, - base::checked_cast<uint16>(i * kResendDelay * kTimeBetweenEventsMs)); + p.AddReceiverEventLog(0, FRAME_ACK_SENT, + base::checked_cast<uint16_t>(i * kResendDelay * + kTimeBetweenEventsMs)); } FrameEvent frame_event; diff --git a/media/cast/net/rtcp/rtcp_defines.cc b/media/cast/net/rtcp/rtcp_defines.cc index 128682b..2648a04 100644 --- a/media/cast/net/rtcp/rtcp_defines.cc +++ b/media/cast/net/rtcp/rtcp_defines.cc @@ -9,7 +9,7 @@ namespace media { namespace cast { -RtcpCastMessage::RtcpCastMessage(uint32 ssrc) +RtcpCastMessage::RtcpCastMessage(uint32_t ssrc) : media_ssrc(ssrc), ack_frame_id(0u), target_delay_ms(0) {} RtcpCastMessage::RtcpCastMessage() : media_ssrc(0), ack_frame_id(0u), target_delay_ms(0) {} @@ -19,7 +19,7 @@ RtcpReceiverEventLogMessage::RtcpReceiverEventLogMessage() : type(UNKNOWN), packet_id(0u) {} RtcpReceiverEventLogMessage::~RtcpReceiverEventLogMessage() {} -RtcpReceiverFrameLogMessage::RtcpReceiverFrameLogMessage(uint32 timestamp) +RtcpReceiverFrameLogMessage::RtcpReceiverFrameLogMessage(uint32_t timestamp) : rtp_timestamp_(timestamp) {} RtcpReceiverFrameLogMessage::~RtcpReceiverFrameLogMessage() {} diff --git a/media/cast/net/rtcp/rtcp_defines.h b/media/cast/net/rtcp/rtcp_defines.h index 72fdc31..032383a 100644 --- a/media/cast/net/rtcp/rtcp_defines.h +++ b/media/cast/net/rtcp/rtcp_defines.h @@ -38,13 +38,13 @@ enum RtcpPacketFields { // Handle the per frame ACK and NACK messages. struct RtcpCastMessage { - explicit RtcpCastMessage(uint32 ssrc); + explicit RtcpCastMessage(uint32_t ssrc); RtcpCastMessage(); ~RtcpCastMessage(); - uint32 media_ssrc; - uint32 ack_frame_id; - uint16 target_delay_ms; + uint32_t media_ssrc; + uint32_t ack_frame_id; + uint16_t target_delay_ms; MissingFramesAndPacketsMap missing_frames_and_packets; }; @@ -56,16 +56,16 @@ struct RtcpReceiverEventLogMessage { CastLoggingEvent type; base::TimeTicks event_timestamp; base::TimeDelta delay_delta; - uint16 packet_id; + uint16_t packet_id; }; typedef std::list<RtcpReceiverEventLogMessage> RtcpReceiverEventLogMessages; struct RtcpReceiverFrameLogMessage { - explicit RtcpReceiverFrameLogMessage(uint32 rtp_timestamp); + explicit RtcpReceiverFrameLogMessage(uint32_t rtp_timestamp); ~RtcpReceiverFrameLogMessage(); - uint32 rtp_timestamp_; + uint32_t rtp_timestamp_; RtcpReceiverEventLogMessages event_log_messages_; // TODO(mikhal): Investigate what's the best way to allow adding @@ -79,9 +79,9 @@ struct RtcpReceiverReferenceTimeReport { RtcpReceiverReferenceTimeReport(); ~RtcpReceiverReferenceTimeReport(); - uint32 remote_ssrc; - uint32 ntp_seconds; - uint32 ntp_fraction; + uint32_t remote_ssrc; + uint32_t ntp_seconds; + uint32_t ntp_fraction; }; inline bool operator==(RtcpReceiverReferenceTimeReport lhs, @@ -107,7 +107,7 @@ struct RtcpEvent { base::TimeDelta delay_delta; // Only set for packet events. - uint16 packet_id; + uint16_t packet_id; }; typedef base::Callback<void(const RtcpCastMessage&)> RtcpCastMessageCallback; @@ -118,16 +118,16 @@ base::Callback<void(const RtcpReceiverLogMessage&)> RtcpLogMessageCallback; // TODO(hubbe): Document members of this struct. struct RtpReceiverStatistics { RtpReceiverStatistics(); - uint8 fraction_lost; - uint32 cumulative_lost; // 24 bits valid. - uint32 extended_high_sequence_number; - uint32 jitter; + uint8_t fraction_lost; + uint32_t cumulative_lost; // 24 bits valid. + uint32_t extended_high_sequence_number; + uint32_t jitter; }; // These are intended to only be created using Rtcp::ConvertToNTPAndSave. struct RtcpTimeData { - uint32 ntp_seconds; - uint32 ntp_fraction; + uint32_t ntp_seconds; + uint32_t ntp_fraction; base::TimeTicks timestamp; }; @@ -136,8 +136,8 @@ struct RtcpTimeData { struct SendRtcpFromRtpReceiver_Params { SendRtcpFromRtpReceiver_Params(); ~SendRtcpFromRtpReceiver_Params(); - uint32 ssrc; - uint32 sender_ssrc; + uint32_t ssrc; + uint32_t sender_ssrc; RtcpTimeData time_data; scoped_ptr<RtcpCastMessage> cast_message; base::TimeDelta target_delay; diff --git a/media/cast/net/rtcp/rtcp_unittest.cc b/media/cast/net/rtcp/rtcp_unittest.cc index 88b7d45..7b85391 100644 --- a/media/cast/net/rtcp/rtcp_unittest.cc +++ b/media/cast/net/rtcp/rtcp_unittest.cc @@ -19,8 +19,8 @@ namespace cast { using testing::_; -static const uint32 kSenderSsrc = 0x10203; -static const uint32 kReceiverSsrc = 0x40506; +static const uint32_t kSenderSsrc = 0x10203; +static const uint32_t kReceiverSsrc = 0x40506; static const int kInitialReceiverClockOffsetSeconds = -5; class FakeRtcpTransport : public PacedPacketSender { @@ -35,7 +35,7 @@ class FakeRtcpTransport : public PacedPacketSender { base::TimeDelta packet_delay() const { return packet_delay_; } void set_packet_delay(base::TimeDelta delay) { packet_delay_ = delay; } - bool SendRtcpPacket(uint32 ssrc, PacketRef packet) final { + bool SendRtcpPacket(uint32_t ssrc, PacketRef packet) final { clock_->Advance(packet_delay_); if (paused_) { packet_queue_.push_back(packet); @@ -143,13 +143,13 @@ TEST_F(RtcpTest, LipSyncGleanedFromSenderReport) { // Initially, expect no lip-sync info receiver-side without having first // received a RTCP packet. base::TimeTicks reference_time; - uint32 rtp_timestamp; + uint32_t rtp_timestamp; ASSERT_FALSE(rtcp_for_receiver_.GetLatestLipSyncTimes(&rtp_timestamp, &reference_time)); // Send a Sender Report to the receiver. const base::TimeTicks reference_time_sent = sender_clock_->NowTicks(); - const uint32 rtp_timestamp_sent = 0xbee5; + const uint32_t rtp_timestamp_sent = 0xbee5; rtcp_for_sender_.SendRtcpFromRtpSender( reference_time_sent, rtp_timestamp_sent, 1, 1); @@ -193,7 +193,7 @@ TEST_F(RtcpTest, RoundTripTimesDeterminedFromReportPingPong) { // Sender --> Receiver base::TimeTicks reference_time_sent = sender_clock_->NowTicks(); - uint32 rtp_timestamp_sent = 0xbee5 + i; + uint32_t rtp_timestamp_sent = 0xbee5 + i; rtcp_for_sender_.SendRtcpFromRtpSender( reference_time_sent, rtp_timestamp_sent, 1, 1); EXPECT_EQ(expected_rtt_according_to_sender, @@ -267,11 +267,11 @@ TEST_F(RtcpTest, NegativeTimeTicks) { // TODO(miu): Find a better home for this test. TEST(MisplacedCastTest, NtpAndTime) { - const int64 kSecondsbetweenYear1900and2010 = INT64_C(40176 * 24 * 60 * 60); - const int64 kSecondsbetweenYear1900and2030 = INT64_C(47481 * 24 * 60 * 60); + const int64_t kSecondsbetweenYear1900and2010 = INT64_C(40176 * 24 * 60 * 60); + const int64_t kSecondsbetweenYear1900and2030 = INT64_C(47481 * 24 * 60 * 60); - uint32 ntp_seconds_1 = 0; - uint32 ntp_fraction_1 = 0; + uint32_t ntp_seconds_1 = 0; + uint32_t ntp_fraction_1 = 0; base::TimeTicks input_time = base::TimeTicks::Now(); ConvertTimeTicksToNtp(input_time, &ntp_seconds_1, &ntp_fraction_1); @@ -285,8 +285,8 @@ TEST(MisplacedCastTest, NtpAndTime) { base::TimeDelta time_delta = base::TimeDelta::FromMilliseconds(1000); input_time += time_delta; - uint32 ntp_seconds_2 = 0; - uint32 ntp_fraction_2 = 0; + uint32_t ntp_seconds_2 = 0; + uint32_t ntp_fraction_2 = 0; ConvertTimeTicksToNtp(input_time, &ntp_seconds_2, &ntp_fraction_2); base::TimeTicks out_2 = ConvertNtpToTimeTicks(ntp_seconds_2, ntp_fraction_2); @@ -300,8 +300,8 @@ TEST(MisplacedCastTest, NtpAndTime) { time_delta = base::TimeDelta::FromMilliseconds(500); input_time += time_delta; - uint32 ntp_seconds_3 = 0; - uint32 ntp_fraction_3 = 0; + uint32_t ntp_seconds_3 = 0; + uint32_t ntp_fraction_3 = 0; ConvertTimeTicksToNtp(input_time, &ntp_seconds_3, &ntp_fraction_3); base::TimeTicks out_3 = ConvertNtpToTimeTicks(ntp_seconds_3, ntp_fraction_3); diff --git a/media/cast/net/rtcp/rtcp_utility.cc b/media/cast/net/rtcp/rtcp_utility.cc index f299258..1ad69eb 100644 --- a/media/cast/net/rtcp/rtcp_utility.cc +++ b/media/cast/net/rtcp/rtcp_utility.cc @@ -24,14 +24,13 @@ const int64_t kUnixEpochInNtpSeconds = INT64_C(2208988800); const double kMagicFractionalUnit = 4.294967296E3; } -RtcpParser::RtcpParser(uint32 local_ssrc, uint32 remote_ssrc) : - local_ssrc_(local_ssrc), - remote_ssrc_(remote_ssrc), - has_sender_report_(false), - has_last_report_(false), - has_cast_message_(false), - has_receiver_reference_time_report_(false) { -} +RtcpParser::RtcpParser(uint32_t local_ssrc, uint32_t remote_ssrc) + : local_ssrc_(local_ssrc), + remote_ssrc_(remote_ssrc), + has_sender_report_(false), + has_last_report_(false), + has_cast_message_(false), + has_receiver_reference_time_report_(false) {} RtcpParser::~RtcpParser() {} @@ -86,7 +85,7 @@ bool RtcpParser::ParseCommonHeader(base::BigEndianReader* reader, // // Common header for all Rtcp packets, 4 octets. - uint8 byte; + uint8_t byte; if (!reader->ReadU8(&byte)) return false; parsed_header->V = byte >> 6; @@ -100,7 +99,7 @@ bool RtcpParser::ParseCommonHeader(base::BigEndianReader* reader, if (!reader->ReadU8(&parsed_header->PT)) return false; - uint16 bytes; + uint16_t bytes; if (!reader->ReadU16(&bytes)) return false; @@ -114,14 +113,14 @@ bool RtcpParser::ParseCommonHeader(base::BigEndianReader* reader, bool RtcpParser::ParseSR(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 sender_ssrc; + uint32_t sender_ssrc; if (!reader->ReadU32(&sender_ssrc)) return false; if (sender_ssrc != remote_ssrc_) return true; - uint32 tmp; + uint32_t tmp; if (!reader->ReadU32(&sender_report_.ntp_seconds) || !reader->ReadU32(&sender_report_.ntp_fraction) || !reader->ReadU32(&sender_report_.rtp_timestamp) || @@ -140,7 +139,7 @@ bool RtcpParser::ParseSR(base::BigEndianReader* reader, bool RtcpParser::ParseRR(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 receiver_ssrc; + uint32_t receiver_ssrc; if (!reader->ReadU32(&receiver_ssrc)) return false; @@ -155,7 +154,7 @@ bool RtcpParser::ParseRR(base::BigEndianReader* reader, } bool RtcpParser::ParseReportBlock(base::BigEndianReader* reader) { - uint32 ssrc, last_report, delay; + uint32_t ssrc, last_report, delay; if (!reader->ReadU32(&ssrc) || !reader->Skip(12) || !reader->ReadU32(&last_report) || @@ -173,8 +172,8 @@ bool RtcpParser::ParseReportBlock(base::BigEndianReader* reader) { bool RtcpParser::ParseApplicationDefined(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 sender_ssrc; - uint32 name; + uint32_t sender_ssrc; + uint32_t name; if (!reader->ReadU32(&sender_ssrc) || !reader->ReadU32(&name)) return false; @@ -198,8 +197,8 @@ bool RtcpParser::ParseCastReceiverLogFrameItem( base::BigEndianReader* reader) { while (reader->remaining()) { - uint32 rtp_timestamp; - uint32 data; + uint32_t rtp_timestamp; + uint32_t data; if (!reader->ReadU32(&rtp_timestamp) || !reader->ReadU32(&data)) return false; @@ -208,19 +207,19 @@ bool RtcpParser::ParseCastReceiverLogFrameItem( base::TimeTicks event_timestamp_base = base::TimeTicks() + base::TimeDelta::FromMilliseconds(data & 0xffffff); - size_t num_events = 1 + static_cast<uint8>(data >> 24); + size_t num_events = 1 + static_cast<uint8_t>(data >> 24); RtcpReceiverFrameLogMessage frame_log(rtp_timestamp); for (size_t event = 0; event < num_events; event++) { - uint16 delay_delta_or_packet_id; - uint16 event_type_and_timestamp_delta; + uint16_t delay_delta_or_packet_id; + uint16_t event_type_and_timestamp_delta; if (!reader->ReadU16(&delay_delta_or_packet_id) || !reader->ReadU16(&event_type_and_timestamp_delta)) return false; RtcpReceiverEventLogMessage event_log; event_log.type = TranslateToLogEventFromWireFormat( - static_cast<uint8>(event_type_and_timestamp_delta >> 12)); + static_cast<uint8_t>(event_type_and_timestamp_delta >> 12)); event_log.event_timestamp = event_timestamp_base + base::TimeDelta::FromMilliseconds( @@ -229,7 +228,7 @@ bool RtcpParser::ParseCastReceiverLogFrameItem( event_log.packet_id = delay_delta_or_packet_id; } else { event_log.delay_delta = base::TimeDelta::FromMilliseconds( - static_cast<int16>(delay_delta_or_packet_id)); + static_cast<int16_t>(delay_delta_or_packet_id)); } frame_log.event_log_messages_.push_back(event_log); } @@ -247,8 +246,8 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, if (header.IC != 15) { return true; } - uint32 remote_ssrc; - uint32 media_ssrc; + uint32_t remote_ssrc; + uint32_t media_ssrc; if (!reader->ReadU32(&remote_ssrc) || !reader->ReadU32(&media_ssrc)) return false; @@ -256,7 +255,7 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, if (remote_ssrc != remote_ssrc_) return true; - uint32 name; + uint32_t name; if (!reader->ReadU32(&name)) return false; @@ -266,8 +265,8 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, cast_message_.media_ssrc = remote_ssrc; - uint8 last_frame_id; - uint8 number_of_lost_fields; + uint8_t last_frame_id; + uint8_t number_of_lost_fields; if (!reader->ReadU8(&last_frame_id) || !reader->ReadU8(&number_of_lost_fields) || !reader->ReadU16(&cast_message_.target_delay_ms)) @@ -277,9 +276,9 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, cast_message_.ack_frame_id = last_frame_id; for (size_t i = 0; i < number_of_lost_fields; i++) { - uint8 frame_id; - uint16 packet_id; - uint8 bitmask; + uint8_t frame_id; + uint16_t packet_id; + uint8_t bitmask; if (!reader->ReadU8(&frame_id) || !reader->ReadU16(&packet_id) || !reader->ReadU8(&bitmask)) @@ -301,7 +300,7 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, bool RtcpParser::ParseExtendedReport(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 remote_ssrc; + uint32_t remote_ssrc; if (!reader->ReadU32(&remote_ssrc)) return false; @@ -310,8 +309,8 @@ bool RtcpParser::ParseExtendedReport(base::BigEndianReader* reader, return true; while (reader->remaining()) { - uint8 block_type; - uint16 block_length; + uint8_t block_type; + uint16_t block_length; if (!reader->ReadU8(&block_type) || !reader->Skip(1) || !reader->ReadU16(&block_length)) @@ -338,7 +337,7 @@ bool RtcpParser::ParseExtendedReport(base::BigEndianReader* reader, bool RtcpParser::ParseExtendedReportReceiverReferenceTimeReport( base::BigEndianReader* reader, - uint32 remote_ssrc) { + uint32_t remote_ssrc) { receiver_reference_time_report_.remote_ssrc = remote_ssrc; if(!reader->ReadU32(&receiver_reference_time_report_.ntp_seconds) || !reader->ReadU32(&receiver_reference_time_report_.ntp_fraction)) @@ -351,7 +350,7 @@ bool RtcpParser::ParseExtendedReportReceiverReferenceTimeReport( // Converts a log event type to an integer value. // NOTE: We have only allocated 4 bits to represent the type of event over the // wire. Therefore, this function can only return values from 0 to 15. -uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event) { +uint8_t ConvertEventTypeToWireFormat(CastLoggingEvent event) { switch (event) { case FRAME_ACK_SENT: return 11; @@ -366,7 +365,7 @@ uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event) { } } -CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event) { +CastLoggingEvent TranslateToLogEventFromWireFormat(uint8_t event) { // TODO(imcheng): Remove the old mappings once they are no longer used. switch (event) { case 1: // AudioAckSent @@ -407,10 +406,10 @@ void ConvertTimeToFractions(int64_t ntp_time_us, // off the entire system. DCHECK_LT(seconds_component, INT64_C(4263431296)) << "One year left to fix the NTP year 2036 wrap-around issue!"; - *seconds = static_cast<uint32>(seconds_component); + *seconds = static_cast<uint32_t>(seconds_component); *fractions = - static_cast<uint32>((ntp_time_us % base::Time::kMicrosecondsPerSecond) * - kMagicFractionalUnit); + static_cast<uint32_t>((ntp_time_us % base::Time::kMicrosecondsPerSecond) * + kMagicFractionalUnit); } void ConvertTimeTicksToNtp(const base::TimeTicks& time, diff --git a/media/cast/net/rtcp/rtcp_utility.h b/media/cast/net/rtcp/rtcp_utility.h index a0a2abff..4092951 100644 --- a/media/cast/net/rtcp/rtcp_utility.h +++ b/media/cast/net/rtcp/rtcp_utility.h @@ -16,24 +16,24 @@ namespace cast { // RFC 3550 page 44, including end null. static const size_t kRtcpCnameSize = 256; -static const uint32 kCast = ('C' << 24) + ('A' << 16) + ('S' << 8) + 'T'; +static const uint32_t kCast = ('C' << 24) + ('A' << 16) + ('S' << 8) + 'T'; -static const uint8 kReceiverLogSubtype = 2; +static const uint8_t kReceiverLogSubtype = 2; static const size_t kRtcpMaxReceiverLogMessages = 256; static const size_t kRtcpMaxCastLossFields = 100; struct RtcpCommonHeader { - uint8 V; // Version. + uint8_t V; // Version. bool P; // Padding. - uint8 IC; // Item count / subtype. - uint8 PT; // Packet Type. + uint8_t IC; // Item count / subtype. + uint8_t PT; // Packet Type. size_t length_in_octets; }; class RtcpParser { public: - RtcpParser(uint32 local_ssrc, uint32 remote_ssrc); + RtcpParser(uint32_t local_ssrc, uint32_t remote_ssrc); ~RtcpParser(); bool Parse(base::BigEndianReader* reader); @@ -44,8 +44,8 @@ class RtcpParser { } bool has_last_report() const { return has_last_report_; } - uint32 last_report() const { return last_report_; } - uint32 delay_since_last_report() const { return delay_since_last_report_; } + uint32_t last_report() const { return last_report_; } + uint32_t delay_since_last_report() const { return delay_since_last_report_; } bool has_receiver_log() const { return !receiver_log_.empty(); } const RtcpReceiverLogMessage& receiver_log() const { return receiver_log_; } @@ -80,18 +80,18 @@ class RtcpParser { const RtcpCommonHeader& header); bool ParseExtendedReportReceiverReferenceTimeReport( base::BigEndianReader* reader, - uint32 remote_ssrc); + uint32_t remote_ssrc); bool ParseExtendedReportDelaySinceLastReceiverReport( base::BigEndianReader* reader); - uint32 local_ssrc_; - uint32 remote_ssrc_; + uint32_t local_ssrc_; + uint32_t remote_ssrc_; bool has_sender_report_; RtcpSenderInfo sender_report_; - uint32 last_report_; - uint32 delay_since_last_report_; + uint32_t last_report_; + uint32_t delay_since_last_report_; bool has_last_report_; // |receiver_log_| is a vector vector, no need for has_*. @@ -109,10 +109,10 @@ class RtcpParser { // Converts a log event type to an integer value. // NOTE: We have only allocated 4 bits to represent the type of event over the // wire. Therefore, this function can only return values from 0 to 15. -uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event); +uint8_t ConvertEventTypeToWireFormat(CastLoggingEvent event); // The inverse of |ConvertEventTypeToWireFormat()|. -CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event); +CastLoggingEvent TranslateToLogEventFromWireFormat(uint8_t event); // Splits an NTP timestamp having a microsecond timebase into the standard two // 32-bit integer wire format. diff --git a/media/cast/net/rtcp/rtcp_utility_unittest.cc b/media/cast/net/rtcp/rtcp_utility_unittest.cc index ec38755..ca68176 100644 --- a/media/cast/net/rtcp/rtcp_utility_unittest.cc +++ b/media/cast/net/rtcp/rtcp_utility_unittest.cc @@ -14,9 +14,9 @@ namespace media { namespace cast { -static const uint32 kSenderSsrc = 0x10203; -static const uint32 kSourceSsrc = 0x40506; -static const uint32 kUnknownSsrc = 0xDEAD; +static const uint32_t kSenderSsrc = 0x10203; +static const uint32_t kSourceSsrc = 0x40506; +static const uint32_t kUnknownSsrc = 0xDEAD; static const base::TimeDelta kTargetDelay = base::TimeDelta::FromMilliseconds(100); @@ -322,9 +322,9 @@ TEST_F(RtcpParserTest, InjectReceiverReportPacketWithCastFeedback) { } TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationBase) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; - static const uint32 kDelayDeltaMs = 123; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; + static const uint32_t kDelayDeltaMs = 123; base::SimpleTestTickClock testing_clock; testing_clock.Advance(base::TimeDelta::FromMilliseconds(kTimeBaseMs)); @@ -365,8 +365,8 @@ TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationBase) { } TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationMulti) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; static const int kDelayDeltaMs = 123; // To be varied for every frame. base::SimpleTestTickClock testing_clock; testing_clock.Advance(base::TimeDelta::FromMilliseconds(kTimeBaseMs)); @@ -392,7 +392,7 @@ TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationMulti) { for (int i = 0; i < 100; ++i) { p.AddReceiverFrameLog(kRtpTimestamp, 1, kTimeBaseMs + i * kTimeDelayMs); const int delay = (i - 50) * kDelayDeltaMs; - p.AddReceiverEventLog(static_cast<uint16>(delay), FRAME_ACK_SENT, 0); + p.AddReceiverEventLog(static_cast<uint16_t>(delay), FRAME_ACK_SENT, 0); } RtcpParser parser(kSourceSsrc, kSenderSsrc); diff --git a/media/cast/net/rtcp/test_rtcp_packet_builder.cc b/media/cast/net/rtcp/test_rtcp_packet_builder.cc index 32e1883..382cde4 100644 --- a/media/cast/net/rtcp/test_rtcp_packet_builder.cc +++ b/media/cast/net/rtcp/test_rtcp_packet_builder.cc @@ -15,7 +15,7 @@ TestRtcpPacketBuilder::TestRtcpPacketBuilder() big_endian_writer_(reinterpret_cast<char*>(buffer_), kMaxIpPacketSize), big_endian_reader_(NULL, 0) {} -void TestRtcpPacketBuilder::AddSr(uint32 sender_ssrc, +void TestRtcpPacketBuilder::AddSr(uint32_t sender_ssrc, int number_of_report_blocks) { AddRtcpHeader(200, number_of_report_blocks); big_endian_writer_.WriteU32(sender_ssrc); @@ -26,10 +26,10 @@ void TestRtcpPacketBuilder::AddSr(uint32 sender_ssrc, big_endian_writer_.WriteU32(kSendOctetCount); } -void TestRtcpPacketBuilder::AddSrWithNtp(uint32 sender_ssrc, - uint32 ntp_high, - uint32 ntp_low, - uint32 rtp_timestamp) { +void TestRtcpPacketBuilder::AddSrWithNtp(uint32_t sender_ssrc, + uint32_t ntp_high, + uint32_t ntp_low, + uint32_t rtp_timestamp) { AddRtcpHeader(200, 0); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU32(ntp_high); @@ -39,13 +39,13 @@ void TestRtcpPacketBuilder::AddSrWithNtp(uint32 sender_ssrc, big_endian_writer_.WriteU32(kSendOctetCount); } -void TestRtcpPacketBuilder::AddRr(uint32 sender_ssrc, +void TestRtcpPacketBuilder::AddRr(uint32_t sender_ssrc, int number_of_report_blocks) { AddRtcpHeader(201, number_of_report_blocks); big_endian_writer_.WriteU32(sender_ssrc); } -void TestRtcpPacketBuilder::AddRb(uint32 rtp_ssrc) { +void TestRtcpPacketBuilder::AddRb(uint32_t rtp_ssrc) { big_endian_writer_.WriteU32(rtp_ssrc); big_endian_writer_.WriteU32(kLoss); big_endian_writer_.WriteU32(kExtendedMax); @@ -54,7 +54,7 @@ void TestRtcpPacketBuilder::AddRb(uint32 rtp_ssrc) { big_endian_writer_.WriteU32(kDelayLastSr); } -void TestRtcpPacketBuilder::AddXrHeader(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddXrHeader(uint32_t sender_ssrc) { AddRtcpHeader(207, 0); big_endian_writer_.WriteU32(sender_ssrc); } @@ -77,7 +77,7 @@ void TestRtcpPacketBuilder::AddUnknownBlock() { big_endian_writer_.WriteU32(42); } -void TestRtcpPacketBuilder::AddXrDlrrBlock(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddXrDlrrBlock(uint32_t sender_ssrc) { big_endian_writer_.WriteU8(5); // Block type. big_endian_writer_.WriteU8(0); // Reserved. big_endian_writer_.WriteU16(3); // Block length. @@ -88,7 +88,7 @@ void TestRtcpPacketBuilder::AddXrDlrrBlock(uint32 sender_ssrc) { big_endian_writer_.WriteU32(kDelayLastRr); } -void TestRtcpPacketBuilder::AddXrExtendedDlrrBlock(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddXrExtendedDlrrBlock(uint32_t sender_ssrc) { big_endian_writer_.WriteU8(5); // Block type. big_endian_writer_.WriteU8(0); // Reserved. big_endian_writer_.WriteU16(9); // Block length. @@ -113,7 +113,7 @@ void TestRtcpPacketBuilder::AddXrRrtrBlock() { big_endian_writer_.WriteU32(kNtpLow); } -void TestRtcpPacketBuilder::AddNack(uint32 sender_ssrc, uint32 media_ssrc) { +void TestRtcpPacketBuilder::AddNack(uint32_t sender_ssrc, uint32_t media_ssrc) { AddRtcpHeader(205, 1); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU32(media_ssrc); @@ -121,15 +121,15 @@ void TestRtcpPacketBuilder::AddNack(uint32 sender_ssrc, uint32 media_ssrc) { big_endian_writer_.WriteU16(0); } -void TestRtcpPacketBuilder::AddSendReportRequest(uint32 sender_ssrc, - uint32 media_ssrc) { +void TestRtcpPacketBuilder::AddSendReportRequest(uint32_t sender_ssrc, + uint32_t media_ssrc) { AddRtcpHeader(205, 5); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU32(media_ssrc); } -void TestRtcpPacketBuilder::AddCast(uint32 sender_ssrc, - uint32 media_ssrc, +void TestRtcpPacketBuilder::AddCast(uint32_t sender_ssrc, + uint32_t media_ssrc, base::TimeDelta target_delay) { AddRtcpHeader(206, 15); big_endian_writer_.WriteU32(sender_ssrc); @@ -152,7 +152,7 @@ void TestRtcpPacketBuilder::AddCast(uint32 sender_ssrc, big_endian_writer_.WriteU8(0); // Lost packet id mask. } -void TestRtcpPacketBuilder::AddReceiverLog(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddReceiverLog(uint32_t sender_ssrc) { AddRtcpHeader(204, 2); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU8('C'); @@ -161,22 +161,22 @@ void TestRtcpPacketBuilder::AddReceiverLog(uint32 sender_ssrc) { big_endian_writer_.WriteU8('T'); } -void TestRtcpPacketBuilder::AddReceiverFrameLog(uint32 rtp_timestamp, +void TestRtcpPacketBuilder::AddReceiverFrameLog(uint32_t rtp_timestamp, int num_events, - uint32 event_timesamp_base) { + uint32_t event_timesamp_base) { big_endian_writer_.WriteU32(rtp_timestamp); - big_endian_writer_.WriteU8(static_cast<uint8>(num_events - 1)); - big_endian_writer_.WriteU8(static_cast<uint8>(event_timesamp_base >> 16)); - big_endian_writer_.WriteU8(static_cast<uint8>(event_timesamp_base >> 8)); - big_endian_writer_.WriteU8(static_cast<uint8>(event_timesamp_base)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(num_events - 1)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(event_timesamp_base >> 16)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(event_timesamp_base >> 8)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(event_timesamp_base)); } -void TestRtcpPacketBuilder::AddReceiverEventLog(uint16 event_data, +void TestRtcpPacketBuilder::AddReceiverEventLog(uint16_t event_data, CastLoggingEvent event, - uint16 event_timesamp_delta) { + uint16_t event_timesamp_delta) { big_endian_writer_.WriteU16(event_data); - uint8 event_id = ConvertEventTypeToWireFormat(event); - uint16 type_and_delta = static_cast<uint16>(event_id) << 12; + uint8_t event_id = ConvertEventTypeToWireFormat(event); + uint16_t type_and_delta = static_cast<uint16_t>(event_id) << 12; type_and_delta += event_timesamp_delta & 0x0fff; big_endian_writer_.WriteU16(type_and_delta); } @@ -187,7 +187,7 @@ scoped_ptr<media::cast::Packet> TestRtcpPacketBuilder::GetPacket() { new media::cast::Packet(buffer_, buffer_ + Length())); } -const uint8* TestRtcpPacketBuilder::Data() { +const uint8_t* TestRtcpPacketBuilder::Data() { PatchLengthField(); return buffer_; } diff --git a/media/cast/net/rtcp/test_rtcp_packet_builder.h b/media/cast/net/rtcp/test_rtcp_packet_builder.h index 948f7a0..04ceb05 100644 --- a/media/cast/net/rtcp/test_rtcp_packet_builder.h +++ b/media/cast/net/rtcp/test_rtcp_packet_builder.h @@ -18,18 +18,18 @@ namespace cast { namespace { // Sender report. -static const uint32 kNtpHigh = 0x01020304; -static const uint32 kNtpLow = 0x05060708; -static const uint32 kRtpTimestamp = 0x10203040; -static const uint32 kSendPacketCount = 987; -static const uint32 kSendOctetCount = 87654; +static const uint32_t kNtpHigh = 0x01020304; +static const uint32_t kNtpLow = 0x05060708; +static const uint32_t kRtpTimestamp = 0x10203040; +static const uint32_t kSendPacketCount = 987; +static const uint32_t kSendOctetCount = 87654; // Report block. static const int kLoss = 0x01000123; static const int kExtendedMax = 0x15678; static const int kTestJitter = 0x10203; -static const uint32 kLastSr = 0x34561234; -static const uint32 kDelayLastSr = 1000; +static const uint32_t kLastSr = 0x34561234; +static const uint32_t kDelayLastSr = 1000; // DLRR block. static const int kLastRr = 0x34561234; @@ -39,9 +39,9 @@ static const int kDelayLastRr = 1000; static const int kMissingPacket = 34567; // CAST. -static const uint32 kAckFrameId = 17; -static const uint32 kLostFrameId = 18; -static const uint32 kFrameIdWithLostPackets = 19; +static const uint32_t kAckFrameId = 17; +static const uint32_t kLostFrameId = 18; +static const uint32_t kFrameIdWithLostPackets = 19; static const int kLostPacketId1 = 3; static const int kLostPacketId2 = 5; static const int kLostPacketId3 = 12; @@ -51,37 +51,37 @@ class TestRtcpPacketBuilder { public: TestRtcpPacketBuilder(); - void AddSr(uint32 sender_ssrc, int number_of_report_blocks); - void AddSrWithNtp(uint32 sender_ssrc, - uint32 ntp_high, - uint32 ntp_low, - uint32 rtp_timestamp); - void AddRr(uint32 sender_ssrc, int number_of_report_blocks); - void AddRb(uint32 rtp_ssrc); - - void AddXrHeader(uint32 sender_ssrc); - void AddXrDlrrBlock(uint32 sender_ssrc); - void AddXrExtendedDlrrBlock(uint32 sender_ssrc); + void AddSr(uint32_t sender_ssrc, int number_of_report_blocks); + void AddSrWithNtp(uint32_t sender_ssrc, + uint32_t ntp_high, + uint32_t ntp_low, + uint32_t rtp_timestamp); + void AddRr(uint32_t sender_ssrc, int number_of_report_blocks); + void AddRb(uint32_t rtp_ssrc); + + void AddXrHeader(uint32_t sender_ssrc); + void AddXrDlrrBlock(uint32_t sender_ssrc); + void AddXrExtendedDlrrBlock(uint32_t sender_ssrc); void AddXrRrtrBlock(); void AddXrUnknownBlock(); void AddUnknownBlock(); - void AddNack(uint32 sender_ssrc, uint32 media_ssrc); - void AddSendReportRequest(uint32 sender_ssrc, uint32 media_ssrc); + void AddNack(uint32_t sender_ssrc, uint32_t media_ssrc); + void AddSendReportRequest(uint32_t sender_ssrc, uint32_t media_ssrc); - void AddCast(uint32 sender_ssrc, - uint32 media_ssrc, + void AddCast(uint32_t sender_ssrc, + uint32_t media_ssrc, base::TimeDelta target_delay); - void AddReceiverLog(uint32 sender_ssrc); - void AddReceiverFrameLog(uint32 rtp_timestamp, + void AddReceiverLog(uint32_t sender_ssrc); + void AddReceiverFrameLog(uint32_t rtp_timestamp, int num_events, - uint32 event_timesamp_base); - void AddReceiverEventLog(uint16 event_data, + uint32_t event_timesamp_base); + void AddReceiverEventLog(uint16_t event_data, CastLoggingEvent event, - uint16 event_timesamp_delta); + uint16_t event_timesamp_delta); scoped_ptr<Packet> GetPacket(); - const uint8* Data(); + const uint8_t* Data(); int Length() { return kMaxIpPacketSize - big_endian_writer_.remaining(); } base::BigEndianReader* Reader(); @@ -91,7 +91,7 @@ class TestRtcpPacketBuilder { // Where the length field of the current packet is. // Note: 0 is not a legal value, it is used for "uninitialized". - uint8 buffer_[kMaxIpPacketSize]; + uint8_t buffer_[kMaxIpPacketSize]; char* ptr_of_length_; base::BigEndianWriter big_endian_writer_; base::BigEndianReader big_endian_reader_; |