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

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

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Implement Asapersson@ comments 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
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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 stats_proxy_->SetAdaptationStats(GetActiveCounts(kCpu), 575 stats_proxy_->SetAdaptationStats(GetActiveCounts(kCpu),
576 GetActiveCounts(kQuality)); 576 GetActiveCounts(kQuality));
577 } 577 }
578 578
579 void ViEEncoder::OnFrame(const VideoFrame& video_frame) { 579 void ViEEncoder::OnFrame(const VideoFrame& video_frame) {
580 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_); 580 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_);
581 VideoFrame incoming_frame = video_frame; 581 VideoFrame incoming_frame = video_frame;
582 582
583 // Local time in webrtc time base. 583 // Local time in webrtc time base.
584 int64_t current_time_ms = clock_->TimeInMilliseconds(); 584 int64_t current_time_us = clock_->TimeInMicroseconds();
585 int64_t current_time_ms = current_time_us / rtc::kNumMicrosecsPerMillisec;
586 // In some cases, e.g. then the frame from decoder is fed to encoder,
587 // the timestamp may be set to the future. As the encoding pipeline assumes
588 // capture time to be less than present time, we should reset the capture
589 // timestamps here. Otherwise there may be issues with RTP send stream.
590 if (incoming_frame.timestamp_us() > current_time_us)
591 incoming_frame.set_timestamp_us(current_time_us);
585 592
586 // Capture time may come from clock with an offset and drift from clock_. 593 // Capture time may come from clock with an offset and drift from clock_.
587 int64_t capture_ntp_time_ms; 594 int64_t capture_ntp_time_ms;
588 if (video_frame.ntp_time_ms() > 0) { 595 if (video_frame.ntp_time_ms() > 0) {
589 capture_ntp_time_ms = video_frame.ntp_time_ms(); 596 capture_ntp_time_ms = video_frame.ntp_time_ms();
590 } else if (video_frame.render_time_ms() != 0) { 597 } else if (video_frame.render_time_ms() != 0) {
591 capture_ntp_time_ms = video_frame.render_time_ms() + delta_ntp_internal_ms_; 598 capture_ntp_time_ms = video_frame.render_time_ms() + delta_ntp_internal_ms_;
592 } else { 599 } else {
593 capture_ntp_time_ms = current_time_ms + delta_ntp_internal_ms_; 600 capture_ntp_time_ms = current_time_ms + delta_ntp_internal_ms_;
594 } 601 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 std::string ViEEncoder::AdaptCounter::ToString( 1058 std::string ViEEncoder::AdaptCounter::ToString(
1052 const std::vector<int>& counters) const { 1059 const std::vector<int>& counters) const {
1053 std::stringstream ss; 1060 std::stringstream ss;
1054 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { 1061 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) {
1055 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; 1062 ss << (reason ? " cpu" : "quality") << ":" << counters[reason];
1056 } 1063 }
1057 return ss.str(); 1064 return ss.str();
1058 } 1065 }
1059 1066
1060 } // namespace webrtc 1067 } // namespace webrtc
OLDNEW
« webrtc/video/video_send_stream_tests.cc ('K') | « webrtc/video/video_send_stream_tests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698