OLD | NEW |
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/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
6 #include "media/cast/logging/logging_impl.h" | 7 #include "media/cast/logging/logging_impl.h" |
7 #include "net/base/big_endian.h" | |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 namespace cast { | 10 namespace cast { |
11 | 11 |
12 LoggingImpl::LoggingImpl( | 12 LoggingImpl::LoggingImpl( |
13 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy, | 13 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy, |
14 const CastLoggingConfig& config) | 14 const CastLoggingConfig& config) |
15 : main_thread_proxy_(main_thread_proxy), | 15 : main_thread_proxy_(main_thread_proxy), |
16 config_(config), | 16 config_(config), |
17 raw_(), | 17 raw_(), |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void LoggingImpl::InsertPacketListEvent(const base::TimeTicks& time_of_event, | 82 void LoggingImpl::InsertPacketListEvent(const base::TimeTicks& time_of_event, |
83 CastLoggingEvent event, | 83 CastLoggingEvent event, |
84 const PacketList& packets) { | 84 const PacketList& packets) { |
85 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 85 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
86 for (unsigned int i = 0; i < packets.size(); ++i) { | 86 for (unsigned int i = 0; i < packets.size(); ++i) { |
87 const Packet& packet = packets[i]; | 87 const Packet& packet = packets[i]; |
88 // Parse basic properties. | 88 // Parse basic properties. |
89 uint32 rtp_timestamp; | 89 uint32 rtp_timestamp; |
90 uint16 packet_id, max_packet_id; | 90 uint16 packet_id, max_packet_id; |
91 const uint8* packet_data = &packet[0]; | 91 const uint8* packet_data = &packet[0]; |
92 net::BigEndianReader big_endian_reader(packet_data + 4, 4); | 92 base::BigEndianReader big_endian_reader( |
| 93 reinterpret_cast<const char*>(packet_data + 4), 4); |
93 big_endian_reader.ReadU32(&rtp_timestamp); | 94 big_endian_reader.ReadU32(&rtp_timestamp); |
94 net::BigEndianReader cast_big_endian_reader(packet_data + 12 + 2, 4); | 95 base::BigEndianReader cast_big_endian_reader( |
| 96 reinterpret_cast<const char*>(packet_data + 12 + 2), 4); |
95 cast_big_endian_reader.ReadU16(&packet_id); | 97 cast_big_endian_reader.ReadU16(&packet_id); |
96 cast_big_endian_reader.ReadU16(&max_packet_id); | 98 cast_big_endian_reader.ReadU16(&max_packet_id); |
97 // rtp_timestamp is enough - no need for frame_id as well. | 99 // rtp_timestamp is enough - no need for frame_id as well. |
98 InsertPacketEvent(time_of_event, event, rtp_timestamp, kFrameIdUnknown, | 100 InsertPacketEvent(time_of_event, event, rtp_timestamp, kFrameIdUnknown, |
99 packet_id, max_packet_id, packet.size()); | 101 packet_id, max_packet_id, packet.size()); |
100 } | 102 } |
101 } | 103 } |
102 | 104 |
103 void LoggingImpl::InsertPacketEvent(const base::TimeTicks& time_of_event, | 105 void LoggingImpl::InsertPacketEvent(const base::TimeTicks& time_of_event, |
104 CastLoggingEvent event, | 106 CastLoggingEvent event, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return stats_.GetGenericStatsData(); | 164 return stats_.GetGenericStatsData(); |
163 } | 165 } |
164 | 166 |
165 void LoggingImpl::ResetStats() { | 167 void LoggingImpl::ResetStats() { |
166 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 168 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
167 stats_.Reset(); | 169 stats_.Reset(); |
168 } | 170 } |
169 | 171 |
170 } // namespace cast | 172 } // namespace cast |
171 } // namespace media | 173 } // namespace media |
OLD | NEW |