| 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 uint32_t* fec_overhead_rate_bps, | 26 uint32_t* fec_overhead_rate_bps, |
| 27 VCMProtectionCallback* video_protection_callback) { | 27 VCMProtectionCallback* video_protection_callback) { |
| 28 FecProtectionParams delta_fec_params; | 28 FecProtectionParams delta_fec_params; |
| 29 FecProtectionParams key_fec_params; | 29 FecProtectionParams key_fec_params; |
| 30 // Get the FEC code rate for Key frames (set to 0 when NA). | 30 // Get the FEC code rate for Key frames (set to 0 when NA). |
| 31 key_fec_params.fec_rate = selected_method->RequiredProtectionFactorK(); | 31 key_fec_params.fec_rate = selected_method->RequiredProtectionFactorK(); |
| 32 | 32 |
| 33 // Get the FEC code rate for Delta frames (set to 0 when NA). | 33 // Get the FEC code rate for Delta frames (set to 0 when NA). |
| 34 delta_fec_params.fec_rate = selected_method->RequiredProtectionFactorD(); | 34 delta_fec_params.fec_rate = selected_method->RequiredProtectionFactorD(); |
| 35 | 35 |
| 36 // Get the FEC-UEP protection status for Key frames: UEP on/off. |
| 37 key_fec_params.use_uep_protection = selected_method->RequiredUepProtectionK(); |
| 38 |
| 39 // Get the FEC-UEP protection status for Delta frames: UEP on/off. |
| 40 delta_fec_params.use_uep_protection = |
| 41 selected_method->RequiredUepProtectionD(); |
| 42 |
| 36 // The RTP module currently requires the same |max_fec_frames| for both | 43 // The RTP module currently requires the same |max_fec_frames| for both |
| 37 // key and delta frames. | 44 // key and delta frames. |
| 38 delta_fec_params.max_fec_frames = selected_method->MaxFramesFec(); | 45 delta_fec_params.max_fec_frames = selected_method->MaxFramesFec(); |
| 39 key_fec_params.max_fec_frames = selected_method->MaxFramesFec(); | 46 key_fec_params.max_fec_frames = selected_method->MaxFramesFec(); |
| 40 | 47 |
| 41 // Set the FEC packet mask type. |kFecMaskBursty| is more effective for | 48 // Set the FEC packet mask type. |kFecMaskBursty| is more effective for |
| 42 // consecutive losses and little/no packet re-ordering. As we currently | 49 // consecutive losses and little/no packet re-ordering. As we currently |
| 43 // do not have feedback data on the degree of correlated losses and packet | 50 // do not have feedback data on the degree of correlated losses and packet |
| 44 // re-ordering, we keep default setting to |kFecMaskRandom| for now. | 51 // re-ordering, we keep default setting to |kFecMaskRandom| for now. |
| 45 delta_fec_params.fec_mask_type = kFecMaskRandom; | 52 delta_fec_params.fec_mask_type = kFecMaskRandom; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 222 |
| 216 // For now use the filtered loss for computing the robustness settings. | 223 // For now use the filtered loss for computing the robustness settings. |
| 217 loss_prot_logic_->UpdateFilteredLossPr(packet_loss_enc); | 224 loss_prot_logic_->UpdateFilteredLossPr(packet_loss_enc); |
| 218 | 225 |
| 219 // Rate cost of the protection methods. | 226 // Rate cost of the protection methods. |
| 220 float protection_overhead_rate = 0.0f; | 227 float protection_overhead_rate = 0.0f; |
| 221 | 228 |
| 222 // Update protection settings, when applicable. | 229 // Update protection settings, when applicable. |
| 223 float sent_video_rate_kbps = 0.0f; | 230 float sent_video_rate_kbps = 0.0f; |
| 224 if (loss_prot_logic_->SelectedType() != kNone) { | 231 if (loss_prot_logic_->SelectedType() != kNone) { |
| 232 // Update protection method with content metrics. |
| 233 selected_method->UpdateContentMetrics(content_->ShortTermAvgData()); |
| 234 |
| 225 // Update method will compute the robustness settings for the given | 235 // Update method will compute the robustness settings for the given |
| 226 // protection method and the overhead cost | 236 // protection method and the overhead cost |
| 227 // the protection method is set by the user via SetVideoProtection. | 237 // the protection method is set by the user via SetVideoProtection. |
| 228 loss_prot_logic_->UpdateMethod(); | 238 loss_prot_logic_->UpdateMethod(); |
| 229 | 239 |
| 230 // Update protection callback with protection settings. | 240 // Update protection callback with protection settings. |
| 231 uint32_t sent_video_rate_bps = 0; | 241 uint32_t sent_video_rate_bps = 0; |
| 232 uint32_t sent_nack_rate_bps = 0; | 242 uint32_t sent_nack_rate_bps = 0; |
| 233 uint32_t sent_fec_rate_bps = 0; | 243 uint32_t sent_fec_rate_bps = 0; |
| 234 // Get the bit cost of protection method, based on the amount of | 244 // Get the bit cost of protection method, based on the amount of |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 if (video_target_bitrate_ > | 624 if (video_target_bitrate_ > |
| 615 suspension_threshold_bps_ + suspension_window_bps_) { | 625 suspension_threshold_bps_ + suspension_window_bps_) { |
| 616 video_suspended_ = false; | 626 video_suspended_ = false; |
| 617 } | 627 } |
| 618 } | 628 } |
| 619 } | 629 } |
| 620 } | 630 } |
| 621 | 631 |
| 622 } // namespace media_optimization | 632 } // namespace media_optimization |
| 623 } // namespace webrtc | 633 } // namespace webrtc |
| OLD | NEW |