| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 qm_->spatial_height_fact = 4.0f / 3.0f; | 891 qm_->spatial_height_fact = 4.0f / 3.0f; |
| 892 } | 892 } |
| 893 // Check for 2x1 selection. | 893 // Check for 2x1 selection. |
| 894 if (spatial_err_v < spatial_err_h * (1.0f - kSpatialErrVertVsHoriz) && | 894 if (spatial_err_v < spatial_err_h * (1.0f - kSpatialErrVertVsHoriz) && |
| 895 spatial_err_v < spatial_err * (1.0f - kSpatialErr2X2VsVert)) { | 895 spatial_err_v < spatial_err * (1.0f - kSpatialErr2X2VsVert)) { |
| 896 qm_->spatial_width_fact = 1.0f; | 896 qm_->spatial_width_fact = 1.0f; |
| 897 qm_->spatial_height_fact = 2.0f; | 897 qm_->spatial_height_fact = 2.0f; |
| 898 } | 898 } |
| 899 } | 899 } |
| 900 | 900 |
| 901 // ROBUSTNESS CLASS | |
| 902 | |
| 903 VCMQmRobustness::VCMQmRobustness() { | |
| 904 Reset(); | |
| 905 } | |
| 906 | |
| 907 VCMQmRobustness::~VCMQmRobustness() {} | |
| 908 | |
| 909 void VCMQmRobustness::Reset() { | |
| 910 prev_total_rate_ = 0.0f; | |
| 911 prev_rtt_time_ = 0; | |
| 912 prev_packet_loss_ = 0; | |
| 913 prev_code_rate_delta_ = 0; | |
| 914 ResetQM(); | |
| 915 } | |
| 916 | |
| 917 // Adjust the FEC rate based on the content and the network state | |
| 918 // (packet loss rate, total rate/bandwidth, round trip time). | |
| 919 // Note that packetLoss here is the filtered loss value. | |
| 920 float VCMQmRobustness::AdjustFecFactor(uint8_t code_rate_delta, | |
| 921 float total_rate, | |
| 922 float framerate, | |
| 923 int64_t rtt_time, | |
| 924 uint8_t packet_loss) { | |
| 925 // Default: no adjustment | |
| 926 float adjust_fec = 1.0f; | |
| 927 if (content_metrics_ == NULL) { | |
| 928 return adjust_fec; | |
| 929 } | |
| 930 // Compute class state of the content. | |
| 931 ComputeMotionNFD(); | |
| 932 ComputeSpatial(); | |
| 933 | |
| 934 // TODO(marpan): Set FEC adjustment factor. | |
| 935 | |
| 936 // Keep track of previous values of network state: | |
| 937 // adjustment may be also based on pattern of changes in network state. | |
| 938 prev_total_rate_ = total_rate; | |
| 939 prev_rtt_time_ = rtt_time; | |
| 940 prev_packet_loss_ = packet_loss; | |
| 941 prev_code_rate_delta_ = code_rate_delta; | |
| 942 return adjust_fec; | |
| 943 } | |
| 944 | |
| 945 // Set the UEP (unequal-protection across packets) on/off for the FEC. | |
| 946 bool VCMQmRobustness::SetUepProtection(uint8_t code_rate_delta, | |
| 947 float total_rate, | |
| 948 uint8_t packet_loss, | |
| 949 bool frame_type) { | |
| 950 // Default. | |
| 951 return false; | |
| 952 } | |
| 953 } // namespace webrtc | 901 } // namespace webrtc |
| OLD | NEW |