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 "media/cast/logging/logging_raw.h" | 5 #include "media/cast/logging/logging_raw.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | |
8 #include "base/logging.h" | 7 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 9 #include "base/time/time.h" |
11 | 10 |
12 namespace media { | 11 namespace media { |
13 namespace cast { | 12 namespace cast { |
14 | 13 |
15 LoggingRaw::LoggingRaw(base::TickClock* clock) | 14 LoggingRaw::LoggingRaw(base::TickClock* clock) |
16 : clock_(clock), | 15 : clock_(clock), |
17 frame_map_(), | 16 frame_map_(), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Create a new map entry. | 56 // Create a new map entry. |
58 FrameEvent info; | 57 FrameEvent info; |
59 info.frame_id = frame_id; | 58 info.frame_id = frame_id; |
60 info.timestamp.push_back(clock_->NowTicks()); | 59 info.timestamp.push_back(clock_->NowTicks()); |
61 info.type.push_back(event); | 60 info.type.push_back(event); |
62 frame_map_.insert(std::make_pair(rtp_timestamp, info)); | 61 frame_map_.insert(std::make_pair(rtp_timestamp, info)); |
63 } else { | 62 } else { |
64 // Insert to an existing entry. | 63 // Insert to an existing entry. |
65 it->second.timestamp.push_back(clock_->NowTicks()); | 64 it->second.timestamp.push_back(clock_->NowTicks()); |
66 it->second.type.push_back(event); | 65 it->second.type.push_back(event); |
| 66 // Do we have a valid frame_id? |
| 67 // We don't always have it to begin with. |
| 68 // TODO(mikhal): Switch frame_id to int when the fix gets in. |
| 69 // This is currently illegal, as frame_id is uint8, so commenting it out. |
| 70 // if (it->second.frame_id == -1 && frame_id != -1) |
| 71 // it->second.frame_id = frame_id; |
67 } | 72 } |
68 } | 73 } |
69 | 74 |
70 void LoggingRaw::InsertPacketEvent(CastLoggingEvent event, | 75 void LoggingRaw::InsertPacketEvent(CastLoggingEvent event, |
71 uint32 rtp_timestamp, | 76 uint32 rtp_timestamp, |
72 uint32 frame_id, | 77 uint32 frame_id, |
73 uint16 packet_id, | 78 uint16 packet_id, |
74 uint16 max_packet_id, | 79 uint16 max_packet_id, |
75 int size) { | 80 size_t size) { |
76 // Is this packet belonging to a new frame? | 81 // Is this packet belonging to a new frame? |
77 PacketRawMap::iterator it = packet_map_.find(rtp_timestamp); | 82 PacketRawMap::iterator it = packet_map_.find(rtp_timestamp); |
78 if (it == packet_map_.end()) { | 83 if (it == packet_map_.end()) { |
79 // Create a new entry - start with base packet map. | 84 // Create a new entry - start with base packet map. |
80 PacketEvent info; | 85 PacketEvent info; |
81 info.frame_id = frame_id; | 86 info.frame_id = frame_id; |
82 info.max_packet_id = max_packet_id; | 87 info.max_packet_id = max_packet_id; |
83 BasePacketInfo base_info; | 88 BasePacketInfo base_info; |
84 base_info.size = size; | 89 base_info.size = size; |
85 base_info.timestamp.push_back(clock_->NowTicks()); | 90 base_info.timestamp.push_back(clock_->NowTicks()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 135 } |
131 | 136 |
132 void LoggingRaw::Reset() { | 137 void LoggingRaw::Reset() { |
133 frame_map_.clear(); | 138 frame_map_.clear(); |
134 packet_map_.clear(); | 139 packet_map_.clear(); |
135 generic_map_.clear(); | 140 generic_map_.clear(); |
136 } | 141 } |
137 | 142 |
138 } // namespace cast | 143 } // namespace cast |
139 } // namespace media | 144 } // namespace media |
OLD | NEW |