OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/receiver/frame_receiver.h" | 5 #include "media/cast/receiver/frame_receiver.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/numerics/safe_conversions.h" |
14 #include "media/cast/cast_config.h" | 15 #include "media/cast/cast_config.h" |
15 #include "media/cast/cast_defines.h" | 16 #include "media/cast/cast_defines.h" |
16 #include "media/cast/cast_environment.h" | 17 #include "media/cast/cast_environment.h" |
17 #include "media/cast/constants.h" | 18 #include "media/cast/constants.h" |
18 #include "media/cast/net/rtcp/rtcp_utility.h" | 19 #include "media/cast/net/rtcp/rtcp_utility.h" |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 const int kMinSchedulingDelayMs = 1; | 23 const int kMinSchedulingDelayMs = 1; |
23 | 24 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 rtp_header.rtp_timestamp; | 123 rtp_header.rtp_timestamp; |
123 | 124 |
124 scoped_ptr<PacketEvent> receive_event(new PacketEvent()); | 125 scoped_ptr<PacketEvent> receive_event(new PacketEvent()); |
125 receive_event->timestamp = now; | 126 receive_event->timestamp = now; |
126 receive_event->type = PACKET_RECEIVED; | 127 receive_event->type = PACKET_RECEIVED; |
127 receive_event->media_type = event_media_type_; | 128 receive_event->media_type = event_media_type_; |
128 receive_event->rtp_timestamp = rtp_header.rtp_timestamp; | 129 receive_event->rtp_timestamp = rtp_header.rtp_timestamp; |
129 receive_event->frame_id = rtp_header.frame_id; | 130 receive_event->frame_id = rtp_header.frame_id; |
130 receive_event->packet_id = rtp_header.packet_id; | 131 receive_event->packet_id = rtp_header.packet_id; |
131 receive_event->max_packet_id = rtp_header.max_packet_id; | 132 receive_event->max_packet_id = rtp_header.max_packet_id; |
132 receive_event->size = payload_size; | 133 receive_event->size = base::checked_cast<uint32_t>(payload_size); |
133 cast_environment_->logger()->DispatchPacketEvent(std::move(receive_event)); | 134 cast_environment_->logger()->DispatchPacketEvent(std::move(receive_event)); |
134 | 135 |
135 bool duplicate = false; | 136 bool duplicate = false; |
136 const bool complete = | 137 const bool complete = |
137 framer_.InsertPacket(payload_data, payload_size, rtp_header, &duplicate); | 138 framer_.InsertPacket(payload_data, payload_size, rtp_header, &duplicate); |
138 | 139 |
139 // Duplicate packets are ignored. | 140 // Duplicate packets are ignored. |
140 if (duplicate) | 141 if (duplicate) |
141 return; | 142 return; |
142 | 143 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); | 350 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
350 RtpReceiverStatistics stats = stats_.GetStatistics(); | 351 RtpReceiverStatistics stats = stats_.GetStatistics(); |
351 transport_->SendRtcpFromRtpReceiver(rtcp_.local_ssrc(), rtcp_.remote_ssrc(), | 352 transport_->SendRtcpFromRtpReceiver(rtcp_.local_ssrc(), rtcp_.remote_ssrc(), |
352 CreateRtcpTimeData(now), NULL, | 353 CreateRtcpTimeData(now), NULL, |
353 base::TimeDelta(), NULL, &stats); | 354 base::TimeDelta(), NULL, &stats); |
354 ScheduleNextRtcpReport(); | 355 ScheduleNextRtcpReport(); |
355 } | 356 } |
356 | 357 |
357 } // namespace cast | 358 } // namespace cast |
358 } // namespace media | 359 } // namespace media |
OLD | NEW |