Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: media/cast/net/pacing/paced_sender.cc

Issue 1515433002: Replace uses of raw uint32's with a type-checked RtpTimeTicks data type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 PacketEvent& event = recent_packet_events_->back(); 328 PacketEvent& event = recent_packet_events_->back();
329 329
330 // Populate the new PacketEvent by parsing the wire-format |packet|. 330 // Populate the new PacketEvent by parsing the wire-format |packet|.
331 // 331 //
332 // TODO(miu): This parsing logic belongs in RtpParser. 332 // TODO(miu): This parsing logic belongs in RtpParser.
333 event.timestamp = clock_->NowTicks(); 333 event.timestamp = clock_->NowTicks();
334 event.type = type; 334 event.type = type;
335 base::BigEndianReader reader(reinterpret_cast<const char*>(&packet[0]), 335 base::BigEndianReader reader(reinterpret_cast<const char*>(&packet[0]),
336 packet.size()); 336 packet.size());
337 bool success = reader.Skip(4); 337 bool success = reader.Skip(4);
338 success &= reader.ReadU32(&event.rtp_timestamp); 338 uint32_t truncated_rtp_timestamp;
339 success &= reader.ReadU32(&truncated_rtp_timestamp);
339 uint32 ssrc; 340 uint32 ssrc;
340 success &= reader.ReadU32(&ssrc); 341 success &= reader.ReadU32(&ssrc);
341 if (ssrc == audio_ssrc_) { 342 if (ssrc == audio_ssrc_) {
343 event.rtp_timestamp = last_logged_audio_rtp_timestamp_ =
344 last_logged_audio_rtp_timestamp_.Expand(truncated_rtp_timestamp);
342 event.media_type = AUDIO_EVENT; 345 event.media_type = AUDIO_EVENT;
343 } else if (ssrc == video_ssrc_) { 346 } else if (ssrc == video_ssrc_) {
347 event.rtp_timestamp = last_logged_video_rtp_timestamp_ =
348 last_logged_video_rtp_timestamp_.Expand(truncated_rtp_timestamp);
344 event.media_type = VIDEO_EVENT; 349 event.media_type = VIDEO_EVENT;
345 } else { 350 } else {
346 DVLOG(3) << "Got unknown ssrc " << ssrc << " when logging packet event"; 351 DVLOG(3) << "Got unknown ssrc " << ssrc << " when logging packet event";
347 return; 352 return;
348 } 353 }
349 success &= reader.Skip(2); 354 success &= reader.Skip(2);
350 success &= reader.ReadU16(&event.packet_id); 355 success &= reader.ReadU16(&event.packet_id);
351 success &= reader.ReadU16(&event.max_packet_id); 356 success &= reader.ReadU16(&event.max_packet_id);
352 event.size = packet.size(); 357 event.size = packet.size();
353 DCHECK(success); 358 DCHECK(success);
354 } 359 }
355 360
356 } // namespace cast 361 } // namespace cast
357 } // namespace media 362 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698