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 static const int kMinKeyFrameRequestIntervalMs = 300; |
| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 << ssrc_streams_.size(); | 581 << ssrc_streams_.size(); |
581 return; | 582 return; |
582 } | 583 } |
583 std::map<unsigned int, int64_t>::iterator time_it = | 584 std::map<unsigned int, int64_t>::iterator time_it = |
584 time_last_intra_request_ms_.find(ssrc); | 585 time_last_intra_request_ms_.find(ssrc); |
585 if (time_it == time_last_intra_request_ms_.end()) { | 586 if (time_it == time_last_intra_request_ms_.end()) { |
586 time_last_intra_request_ms_[ssrc] = 0; | 587 time_last_intra_request_ms_[ssrc] = 0; |
587 } | 588 } |
588 | 589 |
589 int64_t now = TickTime::MillisecondTimestamp(); | 590 int64_t now = TickTime::MillisecondTimestamp(); |
590 if (time_last_intra_request_ms_[ssrc] + kViEMinKeyRequestIntervalMs > now) { | 591 if (time_last_intra_request_ms_[ssrc] + kMinKeyFrameRequestIntervalMs |
| 592 > now) { |
591 return; | 593 return; |
592 } | 594 } |
593 time_last_intra_request_ms_[ssrc] = now; | 595 time_last_intra_request_ms_[ssrc] = now; |
594 idx = stream_it->second; | 596 idx = stream_it->second; |
595 } | 597 } |
596 // Release the critsect before triggering key frame. | 598 // Release the critsect before triggering key frame. |
597 vcm_->IntraFrameRequest(idx); | 599 vcm_->IntraFrameRequest(idx); |
598 } | 600 } |
599 | 601 |
600 void ViEEncoder::OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) { | 602 void ViEEncoder::OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 const uint32_t width, | 703 const uint32_t width, |
702 const uint32_t height) { | 704 const uint32_t height) { |
703 return vpm_->SetTargetResolution(width, height, frame_rate); | 705 return vpm_->SetTargetResolution(width, height, frame_rate); |
704 } | 706 } |
705 | 707 |
706 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 708 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
707 vpm_->SetTargetFramerate(frame_rate); | 709 vpm_->SetTargetFramerate(frame_rate); |
708 } | 710 } |
709 | 711 |
710 } // namespace webrtc | 712 } // namespace webrtc |
OLD | NEW |