| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 int32_t VideoReceiver::SetReceiveChannelParameters(int64_t rtt) { | 124 int32_t VideoReceiver::SetReceiveChannelParameters(int64_t rtt) { |
| 125 rtc::CritScope cs(&receive_crit_); | 125 rtc::CritScope cs(&receive_crit_); |
| 126 _receiver.UpdateRtt(rtt); | 126 _receiver.UpdateRtt(rtt); |
| 127 return 0; | 127 return 0; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Enable or disable a video protection method. | 130 // Enable or disable a video protection method. |
| 131 // Note: This API should be deprecated, as it does not offer a distinction | 131 // Note: This API should be deprecated, as it does not offer a distinction |
| 132 // between the protection method and decoding with or without errors. If such a | 132 // between the protection method and decoding with or without errors. |
| 133 // behavior is desired, use the following API: SetReceiverRobustnessMode. | |
| 134 int32_t VideoReceiver::SetVideoProtection(VCMVideoProtection videoProtection, | 133 int32_t VideoReceiver::SetVideoProtection(VCMVideoProtection videoProtection, |
| 135 bool enable) { | 134 bool enable) { |
| 136 // By default, do not decode with errors. | 135 // By default, do not decode with errors. |
| 137 _receiver.SetDecodeErrorMode(kNoErrors); | 136 _receiver.SetDecodeErrorMode(kNoErrors); |
| 138 switch (videoProtection) { | 137 switch (videoProtection) { |
| 139 case kProtectionNack: { | 138 case kProtectionNack: { |
| 140 RTC_DCHECK(enable); | 139 RTC_DCHECK(enable); |
| 141 _receiver.SetNackMode(kNack, -1, -1); | 140 _receiver.SetNackMode(kNack, -1, -1); |
| 142 break; | 141 break; |
| 143 } | 142 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 _timing->set_render_delay(timeMS); | 404 _timing->set_render_delay(timeMS); |
| 406 return VCM_OK; | 405 return VCM_OK; |
| 407 } | 406 } |
| 408 | 407 |
| 409 // Current video delay | 408 // Current video delay |
| 410 int32_t VideoReceiver::Delay() const { | 409 int32_t VideoReceiver::Delay() const { |
| 411 return _timing->TargetVideoDelay(); | 410 return _timing->TargetVideoDelay(); |
| 412 } | 411 } |
| 413 | 412 |
| 414 int VideoReceiver::SetReceiverRobustnessMode( | 413 int VideoReceiver::SetReceiverRobustnessMode( |
| 415 ReceiverRobustness robustnessMode, | 414 VideoCodingModule::ReceiverRobustness robustnessMode, |
| 416 VCMDecodeErrorMode decode_error_mode) { | 415 VCMDecodeErrorMode decode_error_mode) { |
| 416 RTC_DCHECK(construction_thread_.CalledOnValidThread()); |
| 417 // TODO(tommi): This method must only be called when the decoder thread |
| 418 // is not running and we don't need to hold this lock. |
| 417 rtc::CritScope cs(&receive_crit_); | 419 rtc::CritScope cs(&receive_crit_); |
| 418 switch (robustnessMode) { | 420 switch (robustnessMode) { |
| 419 case VideoCodingModule::kNone: | 421 case VideoCodingModule::kNone: |
| 420 _receiver.SetNackMode(kNoNack, -1, -1); | 422 _receiver.SetNackMode(kNoNack, -1, -1); |
| 421 break; | 423 break; |
| 422 case VideoCodingModule::kHardNack: | 424 case VideoCodingModule::kHardNack: |
| 423 // Always wait for retransmissions (except when decoding with errors). | 425 // Always wait for retransmissions (except when decoding with errors). |
| 424 _receiver.SetNackMode(kNack, -1, -1); | 426 _receiver.SetNackMode(kNack, -1, -1); |
| 425 break; | 427 break; |
| 426 case VideoCodingModule::kSoftNack: | 428 default: |
| 427 #if 1 | 429 RTC_NOTREACHED(); |
| 428 assert(false); // TODO(hlundin): Not completed. | 430 return VCM_PARAMETER_ERROR; |
| 429 return VCM_NOT_IMPLEMENTED; | |
| 430 #else | |
| 431 // Enable hybrid NACK/FEC. Always wait for retransmissions and don't add | |
| 432 // extra delay when RTT is above kLowRttNackMs. | |
| 433 _receiver.SetNackMode(kNack, media_optimization::kLowRttNackMs, -1); | |
| 434 break; | |
| 435 #endif | |
| 436 case VideoCodingModule::kReferenceSelection: | |
| 437 #if 1 | |
| 438 assert(false); // TODO(hlundin): Not completed. | |
| 439 return VCM_NOT_IMPLEMENTED; | |
| 440 #else | |
| 441 if (decode_error_mode == kNoErrors) { | |
| 442 return VCM_PARAMETER_ERROR; | |
| 443 } | |
| 444 _receiver.SetNackMode(kNoNack, -1, -1); | |
| 445 break; | |
| 446 #endif | |
| 447 } | 431 } |
| 448 _receiver.SetDecodeErrorMode(decode_error_mode); | 432 _receiver.SetDecodeErrorMode(decode_error_mode); |
| 449 return VCM_OK; | 433 return VCM_OK; |
| 450 } | 434 } |
| 451 | 435 |
| 452 void VideoReceiver::SetDecodeErrorMode(VCMDecodeErrorMode decode_error_mode) { | 436 void VideoReceiver::SetDecodeErrorMode(VCMDecodeErrorMode decode_error_mode) { |
| 453 rtc::CritScope cs(&receive_crit_); | 437 rtc::CritScope cs(&receive_crit_); |
| 454 _receiver.SetDecodeErrorMode(decode_error_mode); | 438 _receiver.SetDecodeErrorMode(decode_error_mode); |
| 455 } | 439 } |
| 456 | 440 |
| 457 void VideoReceiver::SetNackSettings(size_t max_nack_list_size, | 441 void VideoReceiver::SetNackSettings(size_t max_nack_list_size, |
| 458 int max_packet_age_to_nack, | 442 int max_packet_age_to_nack, |
| 459 int max_incomplete_time_ms) { | 443 int max_incomplete_time_ms) { |
| 460 if (max_nack_list_size != 0) { | 444 if (max_nack_list_size != 0) { |
| 461 rtc::CritScope cs(&process_crit_); | 445 rtc::CritScope cs(&process_crit_); |
| 462 max_nack_list_size_ = max_nack_list_size; | 446 max_nack_list_size_ = max_nack_list_size; |
| 463 } | 447 } |
| 464 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, | 448 _receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
| 465 max_incomplete_time_ms); | 449 max_incomplete_time_ms); |
| 466 } | 450 } |
| 467 | 451 |
| 468 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { | 452 int VideoReceiver::SetMinReceiverDelay(int desired_delay_ms) { |
| 469 return _receiver.SetMinReceiverDelay(desired_delay_ms); | 453 return _receiver.SetMinReceiverDelay(desired_delay_ms); |
| 470 } | 454 } |
| 471 | 455 |
| 472 } // namespace vcm | 456 } // namespace vcm |
| 473 } // namespace webrtc | 457 } // namespace webrtc |
| OLD | NEW |