niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
stefan@webrtc.org | 91c6308 | 2012-01-31 10:49:08 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/video_coding/receiver.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
| 13 | #include <assert.h> |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <cstdint> |
pbos@webrtc.org | 3f655aa | 2014-03-18 11:10:11 +0000 | [diff] [blame] | 15 | #include <cstdlib> |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 16 | #include <utility> |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 17 | #include <vector> |
pbos@webrtc.org | 3f655aa | 2014-03-18 11:10:11 +0000 | [diff] [blame] | 18 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 19 | #include "absl/memory/memory.h" |
| 20 | #include "api/video/encoded_image.h" |
| 21 | #include "common_types.h" // NOLINT(build/include) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 22 | #include "modules/video_coding/encoded_frame.h" |
| 23 | #include "modules/video_coding/internal_defines.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 24 | #include "modules/video_coding/jitter_buffer_common.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "rtc_base/logging.h" |
Ilya Nikolaevskiy | 8c4fe16 | 2018-02-27 15:49:47 +0100 | [diff] [blame] | 26 | #include "rtc_base/numerics/safe_conversions.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 27 | #include "rtc_base/trace_event.h" |
| 28 | #include "system_wrappers/include/clock.h" |
stefan@webrtc.org | 91c6308 | 2012-01-31 10:49:08 +0000 | [diff] [blame] | 29 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | namespace webrtc { |
| 31 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 32 | enum { kMaxReceiverDelayMs = 10000 }; |
| 33 | |
Niels Möller | 689983f | 2018-11-07 16:36:22 +0100 | [diff] [blame] | 34 | VCMReceiver::VCMReceiver(VCMTiming* timing, Clock* clock) |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame] | 35 | : VCMReceiver::VCMReceiver(timing, |
| 36 | clock, |
Niels Möller | 689983f | 2018-11-07 16:36:22 +0100 | [diff] [blame] | 37 | absl::WrapUnique(EventWrapper::Create()), |
| 38 | absl::WrapUnique(EventWrapper::Create()), |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame] | 39 | nullptr, // NackSender |
| 40 | nullptr) // KeyframeRequestSender |
| 41 | {} |
| 42 | |
| 43 | VCMReceiver::VCMReceiver(VCMTiming* timing, |
| 44 | Clock* clock, |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame] | 45 | NackSender* nack_sender, |
| 46 | KeyFrameRequestSender* keyframe_request_sender) |
Niels Möller | 689983f | 2018-11-07 16:36:22 +0100 | [diff] [blame] | 47 | : VCMReceiver(timing, |
| 48 | clock, |
| 49 | absl::WrapUnique(EventWrapper::Create()), |
| 50 | absl::WrapUnique(EventWrapper::Create()), |
| 51 | nack_sender, |
| 52 | keyframe_request_sender) {} |
Qiang Chen | d4cec15 | 2015-06-19 09:17:00 -0700 | [diff] [blame] | 53 | |
| 54 | VCMReceiver::VCMReceiver(VCMTiming* timing, |
| 55 | Clock* clock, |
kwiberg | 3f55dea | 2016-02-29 05:51:59 -0800 | [diff] [blame] | 56 | std::unique_ptr<EventWrapper> receiver_event, |
| 57 | std::unique_ptr<EventWrapper> jitter_buffer_event) |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame] | 58 | : VCMReceiver::VCMReceiver(timing, |
| 59 | clock, |
| 60 | std::move(receiver_event), |
| 61 | std::move(jitter_buffer_event), |
| 62 | nullptr, // NackSender |
| 63 | nullptr) // KeyframeRequestSender |
| 64 | {} |
| 65 | |
| 66 | VCMReceiver::VCMReceiver(VCMTiming* timing, |
| 67 | Clock* clock, |
| 68 | std::unique_ptr<EventWrapper> receiver_event, |
| 69 | std::unique_ptr<EventWrapper> jitter_buffer_event, |
| 70 | NackSender* nack_sender, |
| 71 | KeyFrameRequestSender* keyframe_request_sender) |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 72 | : clock_(clock), |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame] | 73 | jitter_buffer_(clock_, |
| 74 | std::move(jitter_buffer_event), |
| 75 | nack_sender, |
| 76 | keyframe_request_sender), |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 77 | timing_(timing), |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 78 | render_wait_event_(std::move(receiver_event)), |
Peter Boström | 5464a6e | 2015-04-21 16:35:50 +0200 | [diff] [blame] | 79 | max_video_delay_ms_(kMaxVideoDelayMs) { |
| 80 | Reset(); |
| 81 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 82 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 83 | VCMReceiver::~VCMReceiver() { |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 84 | render_wait_event_->Set(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | } |
| 86 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 87 | void VCMReceiver::Reset() { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 88 | rtc::CritScope cs(&crit_sect_); |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 89 | if (!jitter_buffer_.Running()) { |
| 90 | jitter_buffer_.Start(); |
| 91 | } else { |
| 92 | jitter_buffer_.Flush(); |
| 93 | } |
henrik.lundin@webrtc.org | baf6db5 | 2011-11-02 18:58:39 +0000 | [diff] [blame] | 94 | } |
| 95 | |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 96 | void VCMReceiver::UpdateRtt(int64_t rtt) { |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 97 | jitter_buffer_.UpdateRtt(rtt); |
| 98 | } |
| 99 | |
Johan Ahlers | 95348f7 | 2016-06-28 11:11:28 +0200 | [diff] [blame] | 100 | int32_t VCMReceiver::InsertPacket(const VCMPacket& packet) { |
stefan@webrtc.org | 3417eb4 | 2013-05-21 15:25:53 +0000 | [diff] [blame] | 101 | // Insert the packet into the jitter buffer. The packet can either be empty or |
| 102 | // contain media at this point. |
| 103 | bool retransmitted = false; |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 104 | const VCMFrameBufferEnum ret = |
| 105 | jitter_buffer_.InsertPacket(packet, &retransmitted); |
stefan@webrtc.org | 3417eb4 | 2013-05-21 15:25:53 +0000 | [diff] [blame] | 106 | if (ret == kOldPacket) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | return VCM_OK; |
stefan@webrtc.org | 3417eb4 | 2013-05-21 15:25:53 +0000 | [diff] [blame] | 108 | } else if (ret == kFlushIndicator) { |
| 109 | return VCM_FLUSH_INDICATOR; |
| 110 | } else if (ret < 0) { |
stefan@webrtc.org | 3417eb4 | 2013-05-21 15:25:53 +0000 | [diff] [blame] | 111 | return VCM_JITTER_BUFFER_ERROR; |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 112 | } |
stefan@webrtc.org | 3417eb4 | 2013-05-21 15:25:53 +0000 | [diff] [blame] | 113 | if (ret == kCompleteSession && !retransmitted) { |
| 114 | // We don't want to include timestamps which have suffered from |
| 115 | // retransmission here, since we compensate with extra retransmission |
| 116 | // delay within the jitter estimate. |
| 117 | timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds()); |
| 118 | } |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 119 | return VCM_OK; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 120 | } |
| 121 | |
pbos@webrtc.org | 4dd40d6 | 2015-02-17 13:22:43 +0000 | [diff] [blame] | 122 | void VCMReceiver::TriggerDecoderShutdown() { |
| 123 | jitter_buffer_.Stop(); |
| 124 | render_wait_event_->Set(); |
| 125 | } |
| 126 | |
pbos@webrtc.org | 4f16c87 | 2014-11-24 09:06:48 +0000 | [diff] [blame] | 127 | VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms, |
perkj | 796cfaf | 2015-12-10 09:27:38 -0800 | [diff] [blame] | 128 | bool prefer_late_decoding) { |
stefan@webrtc.org | a678a3b | 2013-01-21 07:42:11 +0000 | [diff] [blame] | 129 | const int64_t start_time_ms = clock_->TimeInMilliseconds(); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 130 | uint32_t frame_timestamp = 0; |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 131 | int min_playout_delay_ms = -1; |
| 132 | int max_playout_delay_ms = -1; |
Johan Ahlers | 31b2ec4 | 2016-06-28 13:32:49 +0200 | [diff] [blame] | 133 | int64_t render_time_ms = 0; |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 134 | // Exhaust wait time to get a complete frame for decoding. |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 135 | VCMEncodedFrame* found_frame = |
| 136 | jitter_buffer_.NextCompleteFrame(max_wait_time_ms); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 137 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 138 | if (found_frame) { |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 139 | frame_timestamp = found_frame->Timestamp(); |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 140 | min_playout_delay_ms = found_frame->EncodedImage().playout_delay_.min_ms; |
| 141 | max_playout_delay_ms = found_frame->EncodedImage().playout_delay_.max_ms; |
| 142 | } else { |
Niels Möller | 375b346 | 2019-01-10 15:35:56 +0100 | [diff] [blame^] | 143 | return nullptr; |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 144 | } |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 145 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 146 | if (min_playout_delay_ms >= 0) |
| 147 | timing_->set_min_playout_delay(min_playout_delay_ms); |
| 148 | |
| 149 | if (max_playout_delay_ms >= 0) |
| 150 | timing_->set_max_playout_delay(max_playout_delay_ms); |
mikhal@webrtc.org | d3cd565 | 2013-05-03 17:54:18 +0000 | [diff] [blame] | 151 | |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 152 | // We have a frame - Set timing and render timestamp. |
mikhal@webrtc.org | adc64a7 | 2013-05-30 16:20:18 +0000 | [diff] [blame] | 153 | timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs()); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 154 | const int64_t now_ms = clock_->TimeInMilliseconds(); |
| 155 | timing_->UpdateCurrentDelay(frame_timestamp); |
Johan Ahlers | 31b2ec4 | 2016-06-28 13:32:49 +0200 | [diff] [blame] | 156 | render_time_ms = timing_->RenderTimeMs(frame_timestamp, now_ms); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 157 | // Check render timing. |
| 158 | bool timing_error = false; |
| 159 | // Assume that render timing errors are due to changes in the video stream. |
Johan Ahlers | 31b2ec4 | 2016-06-28 13:32:49 +0200 | [diff] [blame] | 160 | if (render_time_ms < 0) { |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 161 | timing_error = true; |
Johan Ahlers | 31b2ec4 | 2016-06-28 13:32:49 +0200 | [diff] [blame] | 162 | } else if (std::abs(render_time_ms - now_ms) > max_video_delay_ms_) { |
| 163 | int frame_delay = static_cast<int>(std::abs(render_time_ms - now_ms)); |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 164 | RTC_LOG(LS_WARNING) |
| 165 | << "A frame about to be decoded is out of the configured " |
| 166 | << "delay bounds (" << frame_delay << " > " << max_video_delay_ms_ |
| 167 | << "). Resetting the video jitter buffer."; |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 168 | timing_error = true; |
| 169 | } else if (static_cast<int>(timing_->TargetVideoDelay()) > |
| 170 | max_video_delay_ms_) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 171 | RTC_LOG(LS_WARNING) << "The video target delay has grown larger than " |
| 172 | << max_video_delay_ms_ |
| 173 | << " ms. Resetting jitter buffer."; |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 174 | timing_error = true; |
stefan@webrtc.org | 4ce19b1 | 2013-05-06 13:16:51 +0000 | [diff] [blame] | 175 | } |
| 176 | |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 177 | if (timing_error) { |
| 178 | // Timing error => reset timing and flush the jitter buffer. |
| 179 | jitter_buffer_.Flush(); |
stefan@webrtc.org | 9f557c1 | 2013-05-17 12:55:07 +0000 | [diff] [blame] | 180 | timing_->Reset(); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 181 | return NULL; |
| 182 | } |
| 183 | |
perkj | 796cfaf | 2015-12-10 09:27:38 -0800 | [diff] [blame] | 184 | if (prefer_late_decoding) { |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 185 | // Decode frame as close as possible to the render timestamp. |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 186 | const int32_t available_wait_time = |
| 187 | max_wait_time_ms - |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 188 | static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms); |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 189 | uint16_t new_max_wait_time = |
| 190 | static_cast<uint16_t>(VCM_MAX(available_wait_time, 0)); |
Ilya Nikolaevskiy | 8c4fe16 | 2018-02-27 15:49:47 +0100 | [diff] [blame] | 191 | uint32_t wait_time_ms = rtc::saturated_cast<uint32_t>( |
| 192 | timing_->MaxWaitingTime(render_time_ms, clock_->TimeInMilliseconds())); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 193 | if (new_max_wait_time < wait_time_ms) { |
| 194 | // We're not allowed to wait until the frame is supposed to be rendered, |
| 195 | // waiting as long as we're allowed to avoid busy looping, and then return |
| 196 | // NULL. Next call to this function might return the frame. |
Niklas Enbom | b4c5eaa | 2015-06-03 09:34:25 -0700 | [diff] [blame] | 197 | render_wait_event_->Wait(new_max_wait_time); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 198 | return NULL; |
| 199 | } |
| 200 | // Wait until it's time to render. |
| 201 | render_wait_event_->Wait(wait_time_ms); |
| 202 | } |
| 203 | |
| 204 | // Extract the frame from the jitter buffer and set the render time. |
| 205 | VCMEncodedFrame* frame = jitter_buffer_.ExtractAndSetDecode(frame_timestamp); |
mikhal@webrtc.org | 8f86cc8 | 2013-05-07 18:05:21 +0000 | [diff] [blame] | 206 | if (frame == NULL) { |
| 207 | return NULL; |
| 208 | } |
Johan Ahlers | 31b2ec4 | 2016-06-28 13:32:49 +0200 | [diff] [blame] | 209 | frame->SetRenderTime(render_time_ms); |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 210 | TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->Timestamp(), "SetRenderTS", |
Johan Ahlers | 31b2ec4 | 2016-06-28 13:32:49 +0200 | [diff] [blame] | 211 | "render_time", frame->RenderTimeMs()); |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 212 | if (!frame->Complete()) { |
| 213 | // Update stats for incomplete frames. |
stefan@webrtc.org | 4ce19b1 | 2013-05-06 13:16:51 +0000 | [diff] [blame] | 214 | bool retransmitted = false; |
| 215 | const int64_t last_packet_time_ms = |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 216 | jitter_buffer_.LastPacketTime(frame, &retransmitted); |
stefan@webrtc.org | 4ce19b1 | 2013-05-06 13:16:51 +0000 | [diff] [blame] | 217 | if (last_packet_time_ms >= 0 && !retransmitted) { |
| 218 | // We don't want to include timestamps which have suffered from |
| 219 | // retransmission here, since we compensate with extra retransmission |
| 220 | // delay within the jitter estimate. |
mikhal@webrtc.org | 759b041 | 2013-05-07 16:36:00 +0000 | [diff] [blame] | 221 | timing_->IncomingTimestamp(frame_timestamp, last_packet_time_ms); |
stefan@webrtc.org | 4ce19b1 | 2013-05-06 13:16:51 +0000 | [diff] [blame] | 222 | } |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 223 | } |
| 224 | return frame; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 225 | } |
| 226 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 227 | void VCMReceiver::ReleaseFrame(VCMEncodedFrame* frame) { |
| 228 | jitter_buffer_.ReleaseFrame(frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 229 | } |
| 230 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 231 | void VCMReceiver::ReceiveStatistics(uint32_t* bitrate, uint32_t* framerate) { |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 232 | assert(bitrate); |
| 233 | assert(framerate); |
| 234 | jitter_buffer_.IncomingRateStatistics(framerate, bitrate); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 235 | } |
| 236 | |
stefan@webrtc.org | a64300a | 2013-03-04 15:24:40 +0000 | [diff] [blame] | 237 | void VCMReceiver::SetNackMode(VCMNackMode nackMode, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 238 | int64_t low_rtt_nack_threshold_ms, |
| 239 | int64_t high_rtt_nack_threshold_ms) { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 240 | rtc::CritScope cs(&crit_sect_); |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 241 | // Default to always having NACK enabled in hybrid mode. |
stefan@webrtc.org | a64300a | 2013-03-04 15:24:40 +0000 | [diff] [blame] | 242 | jitter_buffer_.SetNackMode(nackMode, low_rtt_nack_threshold_ms, |
| 243 | high_rtt_nack_threshold_ms); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 244 | } |
| 245 | |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 +0000 | [diff] [blame] | 246 | void VCMReceiver::SetNackSettings(size_t max_nack_list_size, |
stefan@webrtc.org | ef14488 | 2013-05-07 19:16:33 +0000 | [diff] [blame] | 247 | int max_packet_age_to_nack, |
| 248 | int max_incomplete_time_ms) { |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 249 | jitter_buffer_.SetNackSettings(max_nack_list_size, max_packet_age_to_nack, |
stefan@webrtc.org | ef14488 | 2013-05-07 19:16:33 +0000 | [diff] [blame] | 250 | max_incomplete_time_ms); |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 +0000 | [diff] [blame] | 251 | } |
| 252 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 253 | VCMNackMode VCMReceiver::NackMode() const { |
kthelgason | d701dfd | 2017-03-27 07:24:57 -0700 | [diff] [blame] | 254 | rtc::CritScope cs(&crit_sect_); |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 255 | return jitter_buffer_.nack_mode(); |
stefan@webrtc.org | 791eec7 | 2011-10-11 07:53:43 +0000 | [diff] [blame] | 256 | } |
| 257 | |
Wan-Teh Chang | b1825a4 | 2015-06-03 15:03:35 -0700 | [diff] [blame] | 258 | std::vector<uint16_t> VCMReceiver::NackList(bool* request_key_frame) { |
| 259 | return jitter_buffer_.GetNackList(request_key_frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 260 | } |
| 261 | |
pbos@webrtc.org | 5570769 | 2014-12-19 15:45:03 +0000 | [diff] [blame] | 262 | void VCMReceiver::RegisterStatsCallback( |
| 263 | VCMReceiveStatisticsCallback* callback) { |
| 264 | jitter_buffer_.RegisterStatsCallback(callback); |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 +0000 | [diff] [blame] | 265 | } |
| 266 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 +0000 | [diff] [blame] | 267 | } // namespace webrtc |