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

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

Issue 270493003: Cast: Deduplicate event types in cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 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
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/transport/pacing/paced_sender.h" 5 #include "media/cast/transport/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/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 namespace transport { 13 namespace transport {
14 14
15 namespace { 15 namespace {
16 16
17 static const int64 kPacingIntervalMs = 10; 17 static const int64 kPacingIntervalMs = 10;
18 // Each frame will be split into no more than kPacingMaxBurstsPerFrame 18 // Each frame will be split into no more than kPacingMaxBurstsPerFrame
19 // bursts of packets. 19 // bursts of packets.
20 static const size_t kPacingMaxBurstsPerFrame = 3; 20 static const size_t kPacingMaxBurstsPerFrame = 3;
21 static const size_t kTargetBurstSize = 10; 21 static const size_t kTargetBurstSize = 10;
22 static const size_t kMaxBurstSize = 20; 22 static const size_t kMaxBurstSize = 20;
23 23
24 using media::cast::CastLoggingEvent;
25
26 CastLoggingEvent GetLoggingEvent(bool is_audio, bool retransmit) {
27 if (retransmit) {
28 return is_audio ? media::cast::kAudioPacketRetransmitted
29 : media::cast::kVideoPacketRetransmitted;
30 } else {
31 return is_audio ? media::cast::kAudioPacketSentToNetwork
32 : media::cast::kVideoPacketSentToNetwork;
33 }
34 }
35
36 } // namespace 24 } // namespace
37 25
38 26 // static
39 PacketKey PacedPacketSender::MakePacketKey(const base::TimeTicks& ticks, 27 PacketKey PacedPacketSender::MakePacketKey(const base::TimeTicks& ticks,
40 uint32 ssrc, 28 uint32 ssrc,
41 uint16 packet_id) { 29 uint16 packet_id) {
42 return std::make_pair(ticks, std::make_pair(ssrc, packet_id)); 30 return std::make_pair(ticks, std::make_pair(ssrc, packet_id));
43 } 31 }
44 32
45 PacedSender::PacedSender( 33 PacedSender::PacedSender(
46 base::TickClock* clock, 34 base::TickClock* clock,
47 LoggingImpl* logging, 35 LoggingImpl* logging,
48 PacketSender* transport, 36 PacketSender* transport,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool is_audio; 213 bool is_audio;
226 if (ssrc == audio_ssrc_) { 214 if (ssrc == audio_ssrc_) {
227 is_audio = true; 215 is_audio = true;
228 } else if (ssrc == video_ssrc_) { 216 } else if (ssrc == video_ssrc_) {
229 is_audio = false; 217 is_audio = false;
230 } else { 218 } else {
231 DVLOG(3) << "Got unknown ssrc " << ssrc << " when logging packet event"; 219 DVLOG(3) << "Got unknown ssrc " << ssrc << " when logging packet event";
232 return; 220 return;
233 } 221 }
234 222
235 CastLoggingEvent event = GetLoggingEvent(is_audio, retransmit); 223 CastLoggingEvent event = retransmit ?
236 224 PACKET_RETRANSMITTED : PACKET_SENT_TO_NETWORK;
237 logging_->InsertSinglePacketEvent(clock_->NowTicks(), event, packet); 225 EventMediaType media_type = is_audio ? AUDIO_EVENT : VIDEO_EVENT;
226 logging_->InsertSinglePacketEvent(clock_->NowTicks(), event, media_type,
227 packet);
238 } 228 }
239 229
240 } // namespace transport 230 } // namespace transport
241 } // namespace cast 231 } // namespace cast
242 } // namespace media 232 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/transport/pacing/paced_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698