| 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 17 matching lines...) Expand all Loading... |
| 28 #include "webrtc/modules/video_coding/include/video_coding.h" | 28 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 29 #include "webrtc/modules/video_processing/include/video_processing.h" | 29 #include "webrtc/modules/video_processing/include/video_processing.h" |
| 30 #include "webrtc/modules/video_render/video_render_defines.h" | 30 #include "webrtc/modules/video_render/video_render_defines.h" |
| 31 #include "webrtc/system_wrappers/include/metrics.h" | 31 #include "webrtc/system_wrappers/include/metrics.h" |
| 32 #include "webrtc/video/call_stats.h" | 32 #include "webrtc/video/call_stats.h" |
| 33 #include "webrtc/video/payload_router.h" | 33 #include "webrtc/video/payload_router.h" |
| 34 #include "webrtc/video/receive_statistics_proxy.h" | 34 #include "webrtc/video/receive_statistics_proxy.h" |
| 35 | 35 |
| 36 namespace webrtc { | 36 namespace webrtc { |
| 37 | 37 |
| 38 static const int kMaxTargetDelayMs = 10000; | |
| 39 const int kMinSendSidePacketHistorySize = 600; | 38 const int kMinSendSidePacketHistorySize = 600; |
| 40 const int kMaxPacketAgeToNack = 450; | 39 const int kMaxPacketAgeToNack = 450; |
| 41 const int kMaxNackListSize = 250; | 40 const int kMaxNackListSize = 250; |
| 42 | 41 |
| 43 // Helper class receiving statistics callbacks. | 42 // Helper class receiving statistics callbacks. |
| 44 class ChannelStatsObserver : public CallStatsObserver { | 43 class ChannelStatsObserver : public CallStatsObserver { |
| 45 public: | 44 public: |
| 46 explicit ChannelStatsObserver(ViEChannel* owner) : owner_(owner) {} | 45 explicit ChannelStatsObserver(ViEChannel* owner) : owner_(owner) {} |
| 47 virtual ~ChannelStatsObserver() {} | 46 virtual ~ChannelStatsObserver() {} |
| 48 | 47 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 uint8_t pltype_fec = 0; | 459 uint8_t pltype_fec = 0; |
| 461 | 460 |
| 462 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 461 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 463 rtp_rtcp->GenericFECStatus(&fec_enabled, &pltype_red, &pltype_fec); | 462 rtp_rtcp->GenericFECStatus(&fec_enabled, &pltype_red, &pltype_fec); |
| 464 if (fec_enabled) | 463 if (fec_enabled) |
| 465 return true; | 464 return true; |
| 466 } | 465 } |
| 467 return false; | 466 return false; |
| 468 } | 467 } |
| 469 | 468 |
| 470 int ViEChannel::SetSenderBufferingMode(int target_delay_ms) { | |
| 471 if ((target_delay_ms < 0) || (target_delay_ms > kMaxTargetDelayMs)) { | |
| 472 LOG(LS_ERROR) << "Invalid send buffer value."; | |
| 473 return -1; | |
| 474 } | |
| 475 if (target_delay_ms == 0) { | |
| 476 // Real-time mode. | |
| 477 nack_history_size_sender_ = kMinSendSidePacketHistorySize; | |
| 478 } else { | |
| 479 nack_history_size_sender_ = GetRequiredNackListSize(target_delay_ms); | |
| 480 // Don't allow a number lower than the default value. | |
| 481 if (nack_history_size_sender_ < kMinSendSidePacketHistorySize) { | |
| 482 nack_history_size_sender_ = kMinSendSidePacketHistorySize; | |
| 483 } | |
| 484 } | |
| 485 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | |
| 486 rtp_rtcp->SetStorePacketsStatus(true, nack_history_size_sender_); | |
| 487 return 0; | |
| 488 } | |
| 489 | |
| 490 int ViEChannel::GetRequiredNackListSize(int target_delay_ms) { | 469 int ViEChannel::GetRequiredNackListSize(int target_delay_ms) { |
| 491 // The max size of the nack list should be large enough to accommodate the | 470 // The max size of the nack list should be large enough to accommodate the |
| 492 // the number of packets (frames) resulting from the increased delay. | 471 // the number of packets (frames) resulting from the increased delay. |
| 493 // Roughly estimating for ~40 packets per frame @ 30fps. | 472 // Roughly estimating for ~40 packets per frame @ 30fps. |
| 494 return target_delay_ms * 40 * 30 / 1000; | 473 return target_delay_ms * 40 * 30 / 1000; |
| 495 } | 474 } |
| 496 | 475 |
| 497 int ViEChannel::SetSendTimestampOffsetStatus(bool enable, int id) { | 476 int ViEChannel::SetSendTimestampOffsetStatus(bool enable, int id) { |
| 498 // Disable any previous registrations of this extension to avoid errors. | 477 // Disable any previous registrations of this extension to avoid errors. |
| 499 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 478 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 rtc::CritScope lock(&crit_); | 938 rtc::CritScope lock(&crit_); |
| 960 receive_stats_callback_ = receive_statistics_proxy; | 939 receive_stats_callback_ = receive_statistics_proxy; |
| 961 } | 940 } |
| 962 | 941 |
| 963 void ViEChannel::SetIncomingVideoStream( | 942 void ViEChannel::SetIncomingVideoStream( |
| 964 IncomingVideoStream* incoming_video_stream) { | 943 IncomingVideoStream* incoming_video_stream) { |
| 965 rtc::CritScope lock(&crit_); | 944 rtc::CritScope lock(&crit_); |
| 966 incoming_video_stream_ = incoming_video_stream; | 945 incoming_video_stream_ = incoming_video_stream; |
| 967 } | 946 } |
| 968 } // namespace webrtc | 947 } // namespace webrtc |
| OLD | NEW |