OLD | NEW |
---|---|
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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 | 615 |
616 stats_proxy_->SetAdaptationStats(GetActiveCounts(kCpu), | 616 stats_proxy_->SetAdaptationStats(GetActiveCounts(kCpu), |
617 GetActiveCounts(kQuality)); | 617 GetActiveCounts(kQuality)); |
618 } | 618 } |
619 | 619 |
620 void ViEEncoder::OnFrame(const VideoFrame& video_frame) { | 620 void ViEEncoder::OnFrame(const VideoFrame& video_frame) { |
621 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_); | 621 RTC_DCHECK_RUNS_SERIALIZED(&incoming_frame_race_checker_); |
622 VideoFrame incoming_frame = video_frame; | 622 VideoFrame incoming_frame = video_frame; |
623 | 623 |
624 // Local time in webrtc time base. | 624 // Local time in webrtc time base. |
625 int64_t current_time_ms = clock_->TimeInMilliseconds(); | 625 int64_t current_time_us = clock_->TimeInMicroseconds(); |
626 int64_t current_time_ms = current_time_us / rtc::kNumMicrosecsPerMillisec; | |
627 // In some cases, e.g. then the frame from decoder is fed to encoder, | |
holmer
2017/06/19 07:48:26
"e.g. when"?
nisse-webrtc
2017/06/19 08:08:39
To be *really* picky, it should be ", e.g., when".
ilnik
2017/06/19 08:41:51
Done.
ilnik
2017/06/19 08:41:51
Done.
| |
628 // the timestamp may be set to the future. As the encoding pipeline assumes | |
holmer
2017/06/19 07:48:26
I don't understand why this would be the case. Can
nisse-webrtc
2017/06/19 08:08:39
Because the decoder doesn't even try to attach the
ilnik
2017/06/19 08:41:51
Yes, that's what happens.
holmer
2017/06/19 12:17:47
Acknowledged, and I agree with your preferences. :
| |
629 // capture time to be less than present time, we should reset the capture | |
630 // timestamps here. Otherwise there may be issues with RTP send stream. | |
631 if (incoming_frame.timestamp_us() > current_time_us) | |
632 incoming_frame.set_timestamp_us(current_time_us); | |
626 | 633 |
627 // Capture time may come from clock with an offset and drift from clock_. | 634 // Capture time may come from clock with an offset and drift from clock_. |
628 int64_t capture_ntp_time_ms; | 635 int64_t capture_ntp_time_ms; |
629 if (video_frame.ntp_time_ms() > 0) { | 636 if (video_frame.ntp_time_ms() > 0) { |
630 capture_ntp_time_ms = video_frame.ntp_time_ms(); | 637 capture_ntp_time_ms = video_frame.ntp_time_ms(); |
631 } else if (video_frame.render_time_ms() != 0) { | 638 } else if (video_frame.render_time_ms() != 0) { |
632 capture_ntp_time_ms = video_frame.render_time_ms() + delta_ntp_internal_ms_; | 639 capture_ntp_time_ms = video_frame.render_time_ms() + delta_ntp_internal_ms_; |
633 } else { | 640 } else { |
634 capture_ntp_time_ms = current_time_ms + delta_ntp_internal_ms_; | 641 capture_ntp_time_ms = current_time_ms + delta_ntp_internal_ms_; |
635 } | 642 } |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1146 std::string ViEEncoder::AdaptCounter::ToString( | 1153 std::string ViEEncoder::AdaptCounter::ToString( |
1147 const std::vector<int>& counters) const { | 1154 const std::vector<int>& counters) const { |
1148 std::stringstream ss; | 1155 std::stringstream ss; |
1149 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { | 1156 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { |
1150 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; | 1157 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; |
1151 } | 1158 } |
1152 return ss.str(); | 1159 return ss.str(); |
1153 } | 1160 } |
1154 | 1161 |
1155 } // namespace webrtc | 1162 } // namespace webrtc |
OLD | NEW |