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

Side by Side Diff: webrtc/video/vie_encoder.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
« no previous file with comments | « webrtc/video/video_stream_decoder.h ('k') | webrtc/video/vie_remb.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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/video/vie_encoder.h" 11 #include "webrtc/video/vie_encoder.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/base/trace_event.h" 19 #include "webrtc/base/trace_event.h"
20 #include "webrtc/base/timeutils.h"
20 #include "webrtc/modules/pacing/paced_sender.h" 21 #include "webrtc/modules/pacing/paced_sender.h"
21 #include "webrtc/modules/video_coding/include/video_coding.h" 22 #include "webrtc/modules/video_coding/include/video_coding.h"
22 #include "webrtc/modules/video_coding/include/video_coding_defines.h" 23 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
23 #include "webrtc/system_wrappers/include/metrics.h" 24 #include "webrtc/system_wrappers/include/metrics.h"
24 #include "webrtc/system_wrappers/include/tick_util.h"
25 #include "webrtc/video/overuse_frame_detector.h" 25 #include "webrtc/video/overuse_frame_detector.h"
26 #include "webrtc/video/send_statistics_proxy.h" 26 #include "webrtc/video/send_statistics_proxy.h"
27 #include "webrtc/video_frame.h" 27 #include "webrtc/video_frame.h"
28 28
29 namespace webrtc { 29 namespace webrtc {
30 30
31 static const float kStopPaddingThresholdMs = 2000; 31 static const float kStopPaddingThresholdMs = 2000;
32 32
33 class QMVideoSettingsCallback : public VCMQMSettingsCallback { 33 class QMVideoSettingsCallback : public VCMQMSettingsCallback {
34 public: 34 public:
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 } 202 }
203 203
204 // Disable padding if only sending one stream and video isn't suspended and 204 // Disable padding if only sending one stream and video isn't suspended and
205 // min-transmit bitrate isn't used (applied later). 205 // min-transmit bitrate isn't used (applied later).
206 if (!video_is_suspended && send_codec.numberOfSimulcastStreams <= 1) 206 if (!video_is_suspended && send_codec.numberOfSimulcastStreams <= 1)
207 pad_up_to_bitrate_bps = 0; 207 pad_up_to_bitrate_bps = 0;
208 208
209 // The amount of padding should decay to zero if no frames are being 209 // The amount of padding should decay to zero if no frames are being
210 // captured/encoded unless a min-transmit bitrate is used. 210 // captured/encoded unless a min-transmit bitrate is used.
211 int64_t now_ms = TickTime::MillisecondTimestamp(); 211 int64_t now_ms = rtc::TimeMillis();
212 if (now_ms - time_of_last_frame_activity_ms > kStopPaddingThresholdMs) 212 if (now_ms - time_of_last_frame_activity_ms > kStopPaddingThresholdMs)
213 pad_up_to_bitrate_bps = 0; 213 pad_up_to_bitrate_bps = 0;
214 214
215 // Pad up to min bitrate. 215 // Pad up to min bitrate.
216 if (pad_up_to_bitrate_bps < min_transmit_bitrate_bps) 216 if (pad_up_to_bitrate_bps < min_transmit_bitrate_bps)
217 pad_up_to_bitrate_bps = min_transmit_bitrate_bps; 217 pad_up_to_bitrate_bps = min_transmit_bitrate_bps;
218 218
219 // Padding may never exceed bitrate estimate. 219 // Padding may never exceed bitrate estimate.
220 if (pad_up_to_bitrate_bps > bitrate_bps) 220 if (pad_up_to_bitrate_bps > bitrate_bps)
221 pad_up_to_bitrate_bps = bitrate_bps; 221 pad_up_to_bitrate_bps = bitrate_bps;
(...skipping 28 matching lines...) Expand all
250 if (encoder_paused_and_dropped_frame_) { 250 if (encoder_paused_and_dropped_frame_) {
251 TRACE_EVENT_ASYNC_END0("webrtc", "EncoderPaused", this); 251 TRACE_EVENT_ASYNC_END0("webrtc", "EncoderPaused", this);
252 } 252 }
253 encoder_paused_and_dropped_frame_ = false; 253 encoder_paused_and_dropped_frame_ = false;
254 } 254 }
255 255
256 void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame) { 256 void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame) {
257 VideoCodecType codec_type; 257 VideoCodecType codec_type;
258 { 258 {
259 rtc::CritScope lock(&data_cs_); 259 rtc::CritScope lock(&data_cs_);
260 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); 260 time_of_last_frame_activity_ms_ = rtc::TimeMillis();
261 if (EncoderPaused()) { 261 if (EncoderPaused()) {
262 TraceFrameDropStart(); 262 TraceFrameDropStart();
263 return; 263 return;
264 } 264 }
265 TraceFrameDropEnd(); 265 TraceFrameDropEnd();
266 codec_type = encoder_config_.codecType; 266 codec_type = encoder_config_.codecType;
267 } 267 }
268 268
269 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", video_frame.render_time_ms(), 269 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", video_frame.render_time_ms(),
270 "Encode"); 270 "Encode");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { 326 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) {
327 if (stats_proxy_) 327 if (stats_proxy_)
328 stats_proxy_->OnSetRates(bitrate_bps, framerate); 328 stats_proxy_->OnSetRates(bitrate_bps, framerate);
329 } 329 }
330 330
331 int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image, 331 int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image,
332 const CodecSpecificInfo* codec_specific_info, 332 const CodecSpecificInfo* codec_specific_info,
333 const RTPFragmentationHeader* fragmentation) { 333 const RTPFragmentationHeader* fragmentation) {
334 { 334 {
335 rtc::CritScope lock(&data_cs_); 335 rtc::CritScope lock(&data_cs_);
336 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); 336 time_of_last_frame_activity_ms_ = rtc::TimeMillis();
337 } 337 }
338 if (stats_proxy_) { 338 if (stats_proxy_) {
339 stats_proxy_->OnSendEncodedImage(encoded_image, codec_specific_info); 339 stats_proxy_->OnSendEncodedImage(encoded_image, codec_specific_info);
340 } 340 }
341 341
342 int success = 0; 342 int success = 0;
343 { 343 {
344 rtc::CritScope lock(&sink_cs_); 344 rtc::CritScope lock(&sink_cs_);
345 success = sink_->Encoded(encoded_image, codec_specific_info, fragmentation); 345 success = sink_->Encoded(encoded_image, codec_specific_info, fragmentation);
346 } 346 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 408 }
409 409
410 int32_t QMVideoSettingsCallback::SetVideoQMSettings( 410 int32_t QMVideoSettingsCallback::SetVideoQMSettings(
411 const uint32_t frame_rate, 411 const uint32_t frame_rate,
412 const uint32_t width, 412 const uint32_t width,
413 const uint32_t height) { 413 const uint32_t height) {
414 return vp_->SetTargetResolution(width, height, frame_rate); 414 return vp_->SetTargetResolution(width, height, frame_rate);
415 } 415 }
416 416
417 } // namespace webrtc 417 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_stream_decoder.h ('k') | webrtc/video/vie_remb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698