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

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

Issue 228603006: Cast: Log whether the video frame is a key frame in kVideoFrameEncoded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win x64 compile 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
« no previous file with comments | « media/cast/logging/logging_impl.cc ('k') | media/cast/logging/logging_raw.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const int kRandomSizeInterval = 100; 75 const int kRandomSizeInterval = 100;
76 base::TimeTicks start_time = testing_clock_.NowTicks(); 76 base::TimeTicks start_time = testing_clock_.NowTicks();
77 base::TimeDelta time_interval = testing_clock_.NowTicks() - start_time; 77 base::TimeDelta time_interval = testing_clock_.NowTicks() - start_time;
78 uint32 rtp_timestamp = 0; 78 uint32 rtp_timestamp = 0;
79 uint32 frame_id = 0; 79 uint32 frame_id = 0;
80 size_t sum_size = 0; 80 size_t sum_size = 0;
81 do { 81 do {
82 int size = kBaseFrameSizeBytes + 82 int size = kBaseFrameSizeBytes +
83 base::RandInt(-kRandomSizeInterval, kRandomSizeInterval); 83 base::RandInt(-kRandomSizeInterval, kRandomSizeInterval);
84 sum_size += static_cast<size_t>(size); 84 sum_size += static_cast<size_t>(size);
85 logging_.InsertFrameEventWithSize(testing_clock_.NowTicks(), 85 logging_.InsertEncodedFrameEvent(testing_clock_.NowTicks(),
86 kAudioFrameCaptured, rtp_timestamp, 86 kVideoFrameEncoded, rtp_timestamp,
87 frame_id, size); 87 frame_id, size, true);
88 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(kFrameIntervalMs)); 88 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(kFrameIntervalMs));
89 rtp_timestamp += kFrameIntervalMs * 90; 89 rtp_timestamp += kFrameIntervalMs * 90;
90 ++frame_id; 90 ++frame_id;
91 time_interval = testing_clock_.NowTicks() - start_time; 91 time_interval = testing_clock_.NowTicks() - start_time;
92 } while (time_interval.InSeconds() < kIntervalTime1S); 92 } while (time_interval.InSeconds() < kIntervalTime1S);
93 // Get logging data. 93 // Get logging data.
94 std::vector<FrameEvent> frame_events; 94 std::vector<FrameEvent> frame_events;
95 event_subscriber_.GetFrameEventsAndReset(&frame_events); 95 event_subscriber_.GetFrameEventsAndReset(&frame_events);
96 // Size of vector should be equal to the number of events logged, which 96 // Size of vector should be equal to the number of events logged, which
97 // equals to number of frames in this case. 97 // equals to number of frames in this case.
(...skipping 30 matching lines...) Expand all
128 base::TimeTicks start_time = testing_clock_.NowTicks(); 128 base::TimeTicks start_time = testing_clock_.NowTicks();
129 base::TimeDelta time_interval = testing_clock_.NowTicks() - start_time; 129 base::TimeDelta time_interval = testing_clock_.NowTicks() - start_time;
130 uint32 rtp_timestamp = 0u; 130 uint32 rtp_timestamp = 0u;
131 uint32 frame_id = 0u; 131 uint32 frame_id = 0u;
132 uint32 num_events = 0u; 132 uint32 num_events = 0u;
133 do { 133 do {
134 logging_.InsertFrameEvent(testing_clock_.NowTicks(), kAudioFrameCaptured, 134 logging_.InsertFrameEvent(testing_clock_.NowTicks(), kAudioFrameCaptured,
135 rtp_timestamp, frame_id); 135 rtp_timestamp, frame_id);
136 ++num_events; 136 ++num_events;
137 if (frame_id % 2) { 137 if (frame_id % 2) {
138 logging_.InsertFrameEventWithSize(testing_clock_.NowTicks(), 138 logging_.InsertEncodedFrameEvent(testing_clock_.NowTicks(),
139 kAudioFrameEncoded, rtp_timestamp, 139 kAudioFrameEncoded, rtp_timestamp,
140 frame_id, 1500); 140 frame_id, 1500, true);
141 } else if (frame_id % 3) { 141 } else if (frame_id % 3) {
142 logging_.InsertFrameEvent(testing_clock_.NowTicks(), kVideoFrameDecoded, 142 logging_.InsertFrameEvent(testing_clock_.NowTicks(), kVideoFrameDecoded,
143 rtp_timestamp, frame_id); 143 rtp_timestamp, frame_id);
144 } else { 144 } else {
145 logging_.InsertFrameEventWithDelay( 145 logging_.InsertFrameEventWithDelay(
146 testing_clock_.NowTicks(), kVideoRenderDelay, rtp_timestamp, frame_id, 146 testing_clock_.NowTicks(), kVideoRenderDelay, rtp_timestamp, frame_id,
147 base::TimeDelta::FromMilliseconds(20)); 147 base::TimeDelta::FromMilliseconds(20));
148 } 148 }
149 ++num_events; 149 ++num_events;
150 150
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 EXPECT_EQ(1u, frame_events.size()); 282 EXPECT_EQ(1u, frame_events.size());
283 frame_events.clear(); 283 frame_events.clear();
284 event_subscriber_2.GetFrameEventsAndReset(&frame_events); 284 event_subscriber_2.GetFrameEventsAndReset(&frame_events);
285 EXPECT_EQ(1u, frame_events.size()); 285 EXPECT_EQ(1u, frame_events.size());
286 286
287 logging_.RemoveRawEventSubscriber(&event_subscriber_2); 287 logging_.RemoveRawEventSubscriber(&event_subscriber_2);
288 } 288 }
289 289
290 } // namespace cast 290 } // namespace cast
291 } // namespace media 291 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/logging_impl.cc ('k') | media/cast/logging/logging_raw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698