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

Side by Side Diff: media/cast/logging/logging_impl.cc

Issue 196433002: Cast: Log sender side packet events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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 "base/big_endian.h" 5 #include "base/big_endian.h"
6 #include "base/debug/trace_event.h" 6 #include "base/debug/trace_event.h"
7 #include "media/cast/logging/logging_impl.h" 7 #include "media/cast/logging/logging_impl.h"
8 8
9 namespace media { 9 namespace media {
10 namespace cast { 10 namespace cast {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 if (config_.enable_tracing) { 73 if (config_.enable_tracing) {
74 std::string event_string = CastLoggingToString(event); 74 std::string event_string = CastLoggingToString(event);
75 TRACE_EVENT_INSTANT2(event_string.c_str(), "FED", TRACE_EVENT_SCOPE_THREAD, 75 TRACE_EVENT_INSTANT2(event_string.c_str(), "FED", TRACE_EVENT_SCOPE_THREAD,
76 "rtp_timestamp", rtp_timestamp, "delay", 76 "rtp_timestamp", rtp_timestamp, "delay",
77 delay.InMilliseconds()); 77 delay.InMilliseconds());
78 } 78 }
79 } 79 }
80 80
81 void LoggingImpl::InsertSinglePacketEvent(const base::TimeTicks& time_of_event,
82 CastLoggingEvent event,
83 const Packet& packet) {
84 DCHECK(thread_checker_.CalledOnValidThread());
85
86 // Parse basic properties.
87 uint32 rtp_timestamp;
88 uint16 packet_id, max_packet_id;
89 const uint8* packet_data = &packet[0];
90 base::BigEndianReader big_endian_reader(
91 reinterpret_cast<const char*>(packet_data + 4), 4);
92 big_endian_reader.ReadU32(&rtp_timestamp);
93 base::BigEndianReader cast_big_endian_reader(
94 reinterpret_cast<const char*>(packet_data + 12 + 2), 4);
95 cast_big_endian_reader.ReadU16(&packet_id);
96 cast_big_endian_reader.ReadU16(&max_packet_id);
97
98 // rtp_timestamp is enough - no need for frame_id as well.
99 InsertPacketEvent(time_of_event,
100 event,
101 rtp_timestamp,
102 kFrameIdUnknown,
103 packet_id,
104 max_packet_id,
105 packet.size());
106 }
107
81 void LoggingImpl::InsertPacketListEvent(const base::TimeTicks& time_of_event, 108 void LoggingImpl::InsertPacketListEvent(const base::TimeTicks& time_of_event,
82 CastLoggingEvent event, 109 CastLoggingEvent event,
83 const PacketList& packets) { 110 const PacketList& packets) {
84 DCHECK(thread_checker_.CalledOnValidThread()); 111 DCHECK(thread_checker_.CalledOnValidThread());
85 for (unsigned int i = 0; i < packets.size(); ++i) { 112 for (PacketList::const_iterator it = packets.begin(); it != packets.end();
86 const Packet& packet = packets[i]; 113 ++it) {
87 // Parse basic properties. 114 InsertSinglePacketEvent(time_of_event, event, *it);
88 uint32 rtp_timestamp;
89 uint16 packet_id, max_packet_id;
90 const uint8* packet_data = &packet[0];
91 base::BigEndianReader big_endian_reader(
92 reinterpret_cast<const char*>(packet_data + 4), 4);
93 big_endian_reader.ReadU32(&rtp_timestamp);
94 base::BigEndianReader cast_big_endian_reader(
95 reinterpret_cast<const char*>(packet_data + 12 + 2), 4);
96 cast_big_endian_reader.ReadU16(&packet_id);
97 cast_big_endian_reader.ReadU16(&max_packet_id);
98 // rtp_timestamp is enough - no need for frame_id as well.
99 InsertPacketEvent(time_of_event, event, rtp_timestamp, kFrameIdUnknown,
100 packet_id, max_packet_id, packet.size());
101 } 115 }
102 } 116 }
103 117
104 void LoggingImpl::InsertPacketEvent(const base::TimeTicks& time_of_event, 118 void LoggingImpl::InsertPacketEvent(const base::TimeTicks& time_of_event,
105 CastLoggingEvent event, 119 CastLoggingEvent event,
106 uint32 rtp_timestamp, uint32 frame_id, 120 uint32 rtp_timestamp, uint32 frame_id,
107 uint16 packet_id, uint16 max_packet_id, 121 uint16 packet_id, uint16 max_packet_id,
108 size_t size) { 122 size_t size) {
109 DCHECK(thread_checker_.CalledOnValidThread()); 123 DCHECK(thread_checker_.CalledOnValidThread());
110 if (config_.enable_raw_data_collection) { 124 if (config_.enable_raw_data_collection) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return stats_.GetGenericStatsData(); 180 return stats_.GetGenericStatsData();
167 } 181 }
168 182
169 void LoggingImpl::ResetStats() { 183 void LoggingImpl::ResetStats() {
170 DCHECK(thread_checker_.CalledOnValidThread()); 184 DCHECK(thread_checker_.CalledOnValidThread());
171 stats_.Reset(); 185 stats_.Reset();
172 } 186 }
173 187
174 } // namespace cast 188 } // namespace cast
175 } // namespace media 189 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698