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/net/pacing/paced_sender.h" | 5 #include "media/cast/net/pacing/paced_sender.h" |
6 | 6 |
7 #include "base/big_endian.h" | 7 #include "base/big_endian.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/numerics/safe_conversions.h" |
11 | 12 |
12 namespace media { | 13 namespace media { |
13 namespace cast { | 14 namespace cast { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 static const int64_t kPacingIntervalMs = 10; | 18 static const int64_t kPacingIntervalMs = 10; |
18 // Each frame will be split into no more than kPacingMaxBurstsPerFrame | 19 // Each frame will be split into no more than kPacingMaxBurstsPerFrame |
19 // bursts of packets. | 20 // bursts of packets. |
20 static const size_t kPacingMaxBurstsPerFrame = 3; | 21 static const size_t kPacingMaxBurstsPerFrame = 3; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 event.rtp_timestamp = last_logged_video_rtp_timestamp_ = | 348 event.rtp_timestamp = last_logged_video_rtp_timestamp_ = |
348 last_logged_video_rtp_timestamp_.Expand(truncated_rtp_timestamp); | 349 last_logged_video_rtp_timestamp_.Expand(truncated_rtp_timestamp); |
349 event.media_type = VIDEO_EVENT; | 350 event.media_type = VIDEO_EVENT; |
350 } else { | 351 } else { |
351 DVLOG(3) << "Got unknown ssrc " << ssrc << " when logging packet event"; | 352 DVLOG(3) << "Got unknown ssrc " << ssrc << " when logging packet event"; |
352 return; | 353 return; |
353 } | 354 } |
354 success &= reader.Skip(2); | 355 success &= reader.Skip(2); |
355 success &= reader.ReadU16(&event.packet_id); | 356 success &= reader.ReadU16(&event.packet_id); |
356 success &= reader.ReadU16(&event.max_packet_id); | 357 success &= reader.ReadU16(&event.max_packet_id); |
357 event.size = packet.size(); | 358 event.size = base::checked_cast<uint32_t>(packet.size()); |
358 DCHECK(success); | 359 DCHECK(success); |
359 } | 360 } |
360 | 361 |
361 } // namespace cast | 362 } // namespace cast |
362 } // namespace media | 363 } // namespace media |
OLD | NEW |