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

Side by Side Diff: webrtc/modules/video_processing/video_decimator.cc

Issue 1888593004: Delete all use of tick_util.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 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 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/base/checks.h" 11 #include "webrtc/base/checks.h"
12 #include "webrtc/base/timeutils.h"
12 #include "webrtc/modules/video_processing/include/video_processing.h" 13 #include "webrtc/modules/video_processing/include/video_processing.h"
13 #include "webrtc/modules/video_processing/video_decimator.h" 14 #include "webrtc/modules/video_processing/video_decimator.h"
14 #include "webrtc/system_wrappers/include/tick_util.h"
15 15
16 #define VD_MIN(a, b) ((a) < (b)) ? (a) : (b) 16 #define VD_MIN(a, b) ((a) < (b)) ? (a) : (b)
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 VPMVideoDecimator::VPMVideoDecimator() { 20 VPMVideoDecimator::VPMVideoDecimator() {
21 Reset(); 21 Reset();
22 } 22 }
23 23
24 VPMVideoDecimator::~VPMVideoDecimator() {} 24 VPMVideoDecimator::~VPMVideoDecimator() {}
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 overshoot_modifier_ = overshoot % target_frame_rate_; 88 overshoot_modifier_ = overshoot % target_frame_rate_;
89 drop = false; 89 drop = false;
90 drop_count_ = 0; 90 drop_count_ = 0;
91 } 91 }
92 } 92 }
93 } 93 }
94 return drop; 94 return drop;
95 } 95 }
96 96
97 uint32_t VPMVideoDecimator::GetDecimatedFrameRate() { 97 uint32_t VPMVideoDecimator::GetDecimatedFrameRate() {
98 ProcessIncomingframe_rate(TickTime::MillisecondTimestamp()); 98 ProcessIncomingframe_rate(rtc::TimeMillis());
99 if (!enable_temporal_decimation_) { 99 if (!enable_temporal_decimation_) {
100 return static_cast<uint32_t>(incoming_frame_rate_ + 0.5f); 100 return static_cast<uint32_t>(incoming_frame_rate_ + 0.5f);
101 } 101 }
102 return VD_MIN(target_frame_rate_, 102 return VD_MIN(target_frame_rate_,
103 static_cast<uint32_t>(incoming_frame_rate_ + 0.5f)); 103 static_cast<uint32_t>(incoming_frame_rate_ + 0.5f));
104 } 104 }
105 105
106 uint32_t VPMVideoDecimator::Inputframe_rate() { 106 uint32_t VPMVideoDecimator::Inputframe_rate() {
107 ProcessIncomingframe_rate(TickTime::MillisecondTimestamp()); 107 ProcessIncomingframe_rate(rtc::TimeMillis());
108 return static_cast<uint32_t>(incoming_frame_rate_ + 0.5f); 108 return static_cast<uint32_t>(incoming_frame_rate_ + 0.5f);
109 } 109 }
110 110
111 void VPMVideoDecimator::UpdateIncomingframe_rate() { 111 void VPMVideoDecimator::UpdateIncomingframe_rate() {
112 int64_t now = TickTime::MillisecondTimestamp(); 112 int64_t now = rtc::TimeMillis();
113 if (incoming_frame_times_[0] == 0) { 113 if (incoming_frame_times_[0] == 0) {
114 // First no shift. 114 // First no shift.
115 } else { 115 } else {
116 // Shift. 116 // Shift.
117 for (int i = kFrameCountHistory_size - 2; i >= 0; i--) { 117 for (int i = kFrameCountHistory_size - 2; i >= 0; i--) {
118 incoming_frame_times_[i + 1] = incoming_frame_times_[i]; 118 incoming_frame_times_[i + 1] = incoming_frame_times_[i];
119 } 119 }
120 } 120 }
121 incoming_frame_times_[0] = now; 121 incoming_frame_times_[0] = now;
122 ProcessIncomingframe_rate(now); 122 ProcessIncomingframe_rate(now);
(...skipping 16 matching lines...) Expand all
139 incoming_frame_rate_ = 1.0; 139 incoming_frame_rate_ = 1.0;
140 if (diff > 0) { 140 if (diff > 0) {
141 incoming_frame_rate_ = nrOfFrames * 1000.0f / static_cast<float>(diff); 141 incoming_frame_rate_ = nrOfFrames * 1000.0f / static_cast<float>(diff);
142 } 142 }
143 } else { 143 } else {
144 incoming_frame_rate_ = static_cast<float>(nrOfFrames); 144 incoming_frame_rate_ = static_cast<float>(nrOfFrames);
145 } 145 }
146 } 146 }
147 147
148 } // namespace webrtc 148 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_processing/test/video_processing_unittest.cc ('k') | webrtc/system_wrappers/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698