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

Side by Side Diff: webrtc/video/vie_encoder.cc

Issue 2763023002: Propagate input capture time in ViEEncoder::OnFrame. (Closed)
Patch Set: Undo change to FrameGenerators, only FrameGeneratorCapturer need to set timestamp. Created 3 years, 6 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/test/frame_generator_capturer.cc ('k') | no next file » | 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
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 stats_proxy_->SetAdaptationStats(GetActiveCounts(kCpu), 581 stats_proxy_->SetAdaptationStats(GetActiveCounts(kCpu),
582 GetActiveCounts(kQuality)); 582 GetActiveCounts(kQuality));
583 } 583 }
584 584
585 void ViEEncoder::OnFrame(const VideoFrame& video_frame) { 585 void ViEEncoder::OnFrame(const VideoFrame& video_frame) {
586 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_); 586 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_);
587 VideoFrame incoming_frame = video_frame; 587 VideoFrame incoming_frame = video_frame;
588 588
589 // Local time in webrtc time base. 589 // Local time in webrtc time base.
590 int64_t current_time_us = clock_->TimeInMicroseconds(); 590 int64_t current_time_ms = clock_->TimeInMilliseconds();
591 int64_t current_time_ms = current_time_us / rtc::kNumMicrosecsPerMillisec;
592 // TODO(nisse): This always overrides the incoming timestamp. Don't
593 // do that, trust the frame source.
594 incoming_frame.set_timestamp_us(current_time_us);
595 591
596 // Capture time may come from clock with an offset and drift from clock_. 592 // Capture time may come from clock with an offset and drift from clock_.
597 int64_t capture_ntp_time_ms; 593 int64_t capture_ntp_time_ms;
598 if (video_frame.ntp_time_ms() > 0) { 594 if (video_frame.ntp_time_ms() > 0) {
599 capture_ntp_time_ms = video_frame.ntp_time_ms(); 595 capture_ntp_time_ms = video_frame.ntp_time_ms();
600 } else if (video_frame.render_time_ms() != 0) { 596 } else if (video_frame.render_time_ms() != 0) {
601 capture_ntp_time_ms = video_frame.render_time_ms() + delta_ntp_internal_ms_; 597 capture_ntp_time_ms = video_frame.render_time_ms() + delta_ntp_internal_ms_;
602 } else { 598 } else {
603 capture_ntp_time_ms = current_time_ms + delta_ntp_internal_ms_; 599 capture_ntp_time_ms = current_time_ms + delta_ntp_internal_ms_;
604 } 600 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 std::string ViEEncoder::AdaptCounter::ToString( 1056 std::string ViEEncoder::AdaptCounter::ToString(
1061 const std::vector<int>& counters) const { 1057 const std::vector<int>& counters) const {
1062 std::stringstream ss; 1058 std::stringstream ss;
1063 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { 1059 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) {
1064 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; 1060 ss << (reason ? " cpu" : "quality") << ":" << counters[reason];
1065 } 1061 }
1066 return ss.str(); 1062 return ss.str();
1067 } 1063 }
1068 1064
1069 } // namespace webrtc 1065 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/frame_generator_capturer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698