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

Side by Side Diff: media/cast/audio_receiver/audio_receiver.cc

Issue 250363002: [Cast] Clean-up RtpCastHeader and RtpParser, removing the last WebRTC dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed hubbe's comment. Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/README ('k') | media/cast/audio_receiver/audio_receiver_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/audio_receiver/audio_receiver.h" 5 #include "media/cast/audio_receiver/audio_receiver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void AudioReceiver::OnReceivedPayloadData(const uint8* payload_data, 71 void AudioReceiver::OnReceivedPayloadData(const uint8* payload_data,
72 size_t payload_size, 72 size_t payload_size,
73 const RtpCastHeader& rtp_header) { 73 const RtpCastHeader& rtp_header) {
74 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 74 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
75 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 75 base::TimeTicks now = cast_environment_->Clock()->NowTicks();
76 76
77 // TODO(pwestin): update this as video to refresh over time. 77 // TODO(pwestin): update this as video to refresh over time.
78 if (time_first_incoming_packet_.is_null()) { 78 if (time_first_incoming_packet_.is_null()) {
79 InitializeTimers(); 79 InitializeTimers();
80 first_incoming_rtp_timestamp_ = rtp_header.webrtc.header.timestamp; 80 first_incoming_rtp_timestamp_ = rtp_header.rtp_timestamp;
81 time_first_incoming_packet_ = now; 81 time_first_incoming_packet_ = now;
82 } 82 }
83 83
84 frame_id_to_rtp_timestamp_[rtp_header.frame_id & 0xff] = 84 frame_id_to_rtp_timestamp_[rtp_header.frame_id & 0xff] =
85 rtp_header.webrtc.header.timestamp; 85 rtp_header.rtp_timestamp;
86 cast_environment_->Logging()->InsertPacketEvent( 86 cast_environment_->Logging()->InsertPacketEvent(
87 now, kAudioPacketReceived, rtp_header.webrtc.header.timestamp, 87 now, kAudioPacketReceived, rtp_header.rtp_timestamp,
88 rtp_header.frame_id, rtp_header.packet_id, rtp_header.max_packet_id, 88 rtp_header.frame_id, rtp_header.packet_id, rtp_header.max_packet_id,
89 payload_size); 89 payload_size);
90 90
91 bool duplicate = false; 91 bool duplicate = false;
92 const bool complete = 92 const bool complete =
93 framer_.InsertPacket(payload_data, payload_size, rtp_header, &duplicate); 93 framer_.InsertPacket(payload_data, payload_size, rtp_header, &duplicate);
94 if (duplicate) { 94 if (duplicate) {
95 cast_environment_->Logging()->InsertPacketEvent( 95 cast_environment_->Logging()->InsertPacketEvent(
96 now, 96 now,
97 kDuplicateAudioPacketReceived, 97 kDuplicateAudioPacketReceived,
98 rtp_header.webrtc.header.timestamp, 98 rtp_header.rtp_timestamp,
99 rtp_header.frame_id, 99 rtp_header.frame_id,
100 rtp_header.packet_id, 100 rtp_header.packet_id,
101 rtp_header.max_packet_id, 101 rtp_header.max_packet_id,
102 payload_size); 102 payload_size);
103 // Duplicate packets are ignored. 103 // Duplicate packets are ignored.
104 return; 104 return;
105 } 105 }
106 if (!complete) 106 if (!complete)
107 return; 107 return;
108 108
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 373 }
374 374
375 void AudioReceiver::SendNextCastMessage() { 375 void AudioReceiver::SendNextCastMessage() {
376 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 376 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
377 framer_.SendCastMessage(); // Will only send a message if it is time. 377 framer_.SendCastMessage(); // Will only send a message if it is time.
378 ScheduleNextCastMessage(); 378 ScheduleNextCastMessage();
379 } 379 }
380 380
381 } // namespace cast 381 } // namespace cast
382 } // namespace media 382 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/README ('k') | media/cast/audio_receiver/audio_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698