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 15 matching lines...) Expand all Loading... | |
26 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" | 26 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" |
27 #include "webrtc/modules/video_coding/main/interface/video_coding.h" | 27 #include "webrtc/modules/video_coding/main/interface/video_coding.h" |
28 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" | 28 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" |
29 #include "webrtc/modules/video_coding/main/source/encoded_frame.h" | 29 #include "webrtc/modules/video_coding/main/source/encoded_frame.h" |
30 #include "webrtc/system_wrappers/include/clock.h" | 30 #include "webrtc/system_wrappers/include/clock.h" |
31 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 31 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
32 #include "webrtc/system_wrappers/include/metrics.h" | 32 #include "webrtc/system_wrappers/include/metrics.h" |
33 #include "webrtc/system_wrappers/include/tick_util.h" | 33 #include "webrtc/system_wrappers/include/tick_util.h" |
34 #include "webrtc/video/send_statistics_proxy.h" | 34 #include "webrtc/video/send_statistics_proxy.h" |
35 #include "webrtc/video_engine/payload_router.h" | 35 #include "webrtc/video_engine/payload_router.h" |
36 #include "webrtc/video_engine/vie_defines.h" | |
37 | 36 |
38 namespace webrtc { | 37 namespace webrtc { |
39 | 38 |
40 // Margin on when we pause the encoder when the pacing buffer overflows relative | 39 // Margin on when we pause the encoder when the pacing buffer overflows relative |
41 // to the configured buffer delay. | 40 // to the configured buffer delay. |
42 static const float kEncoderPausePacerMargin = 2.0f; | 41 static const float kEncoderPausePacerMargin = 2.0f; |
43 | 42 |
44 // Don't stop the encoder unless the delay is above this configured value. | 43 // Don't stop the encoder unless the delay is above this configured value. |
45 static const int kMinPacingDelayMs = 200; | 44 static const int kMinPacingDelayMs = 200; |
46 | 45 |
47 static const float kStopPaddingThresholdMs = 2000; | 46 static const float kStopPaddingThresholdMs = 2000; |
48 | 47 |
48 const int kMinKeyFrameRequestIntervalMs = 300; | |
pbos-webrtc
2015/10/29 15:39:41
static
mflodman
2015/11/06 11:38:36
Done.
| |
49 | |
49 std::vector<uint32_t> AllocateStreamBitrates( | 50 std::vector<uint32_t> AllocateStreamBitrates( |
50 uint32_t total_bitrate, | 51 uint32_t total_bitrate, |
51 const SimulcastStream* stream_configs, | 52 const SimulcastStream* stream_configs, |
52 size_t number_of_streams) { | 53 size_t number_of_streams) { |
53 if (number_of_streams == 0) { | 54 if (number_of_streams == 0) { |
54 std::vector<uint32_t> stream_bitrates(1, 0); | 55 std::vector<uint32_t> stream_bitrates(1, 0); |
55 stream_bitrates[0] = total_bitrate; | 56 stream_bitrates[0] = total_bitrate; |
56 return stream_bitrates; | 57 return stream_bitrates; |
57 } | 58 } |
58 std::vector<uint32_t> stream_bitrates(number_of_streams, 0); | 59 std::vector<uint32_t> stream_bitrates(number_of_streams, 0); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 << ssrc_streams_.size(); | 594 << ssrc_streams_.size(); |
594 return; | 595 return; |
595 } | 596 } |
596 std::map<unsigned int, int64_t>::iterator time_it = | 597 std::map<unsigned int, int64_t>::iterator time_it = |
597 time_last_intra_request_ms_.find(ssrc); | 598 time_last_intra_request_ms_.find(ssrc); |
598 if (time_it == time_last_intra_request_ms_.end()) { | 599 if (time_it == time_last_intra_request_ms_.end()) { |
599 time_last_intra_request_ms_[ssrc] = 0; | 600 time_last_intra_request_ms_[ssrc] = 0; |
600 } | 601 } |
601 | 602 |
602 int64_t now = TickTime::MillisecondTimestamp(); | 603 int64_t now = TickTime::MillisecondTimestamp(); |
603 if (time_last_intra_request_ms_[ssrc] + kViEMinKeyRequestIntervalMs > now) { | 604 if (time_last_intra_request_ms_[ssrc] + kMinKeyFrameRequestIntervalMs |
605 > now) { | |
604 return; | 606 return; |
605 } | 607 } |
606 time_last_intra_request_ms_[ssrc] = now; | 608 time_last_intra_request_ms_[ssrc] = now; |
607 idx = stream_it->second; | 609 idx = stream_it->second; |
608 } | 610 } |
609 // Release the critsect before triggering key frame. | 611 // Release the critsect before triggering key frame. |
610 vcm_->IntraFrameRequest(idx); | 612 vcm_->IntraFrameRequest(idx); |
611 } | 613 } |
612 | 614 |
613 void ViEEncoder::OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) { | 615 void ViEEncoder::OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 const uint32_t width, | 716 const uint32_t width, |
715 const uint32_t height) { | 717 const uint32_t height) { |
716 return vpm_->SetTargetResolution(width, height, frame_rate); | 718 return vpm_->SetTargetResolution(width, height, frame_rate); |
717 } | 719 } |
718 | 720 |
719 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 721 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
720 vpm_->SetTargetFramerate(frame_rate); | 722 vpm_->SetTargetFramerate(frame_rate); |
721 } | 723 } |
722 | 724 |
723 } // namespace webrtc | 725 } // namespace webrtc |
OLD | NEW |