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 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h" | 10 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return diff / kVideoPayloadTypeFrequency >= kSsCleanupIntervalSec; | 161 return diff / kVideoPayloadTypeFrequency >= kSsCleanupIntervalSec; |
162 } | 162 } |
163 | 163 |
164 void Vp9SsMap::AdvanceFront(uint32_t timestamp) { | 164 void Vp9SsMap::AdvanceFront(uint32_t timestamp) { |
165 RTC_DCHECK(!ss_map_.empty()); | 165 RTC_DCHECK(!ss_map_.empty()); |
166 GofInfoVP9 gof = ss_map_.begin()->second; | 166 GofInfoVP9 gof = ss_map_.begin()->second; |
167 ss_map_.erase(ss_map_.begin()); | 167 ss_map_.erase(ss_map_.begin()); |
168 ss_map_[timestamp] = gof; | 168 ss_map_[timestamp] = gof; |
169 } | 169 } |
170 | 170 |
171 // TODO(asapersson): Update according to updates in RTP payload profile. | |
172 bool Vp9SsMap::UpdatePacket(VCMPacket* packet) { | 171 bool Vp9SsMap::UpdatePacket(VCMPacket* packet) { |
173 uint8_t gof_idx = packet->codecSpecificHeader.codecHeader.VP9.gof_idx; | 172 uint8_t gof_idx = packet->codecSpecificHeader.codecHeader.VP9.gof_idx; |
174 if (gof_idx == kNoGofIdx) | 173 if (gof_idx == kNoGofIdx) |
175 return false; // No update needed. | 174 return false; // No update needed. |
176 | 175 |
177 SsMap::iterator it; | 176 SsMap::iterator it; |
178 if (!Find(packet->timestamp, &it)) | 177 if (!Find(packet->timestamp, &it)) |
179 return false; // Corresponding SS not yet received. | 178 return false; // Corresponding SS not yet received. |
180 | 179 |
181 if (gof_idx >= it->second.num_frames_in_gof) | 180 if (gof_idx >= it->second.num_frames_in_gof) |
182 return false; // Assume corresponding SS not yet received. | 181 return false; // Assume corresponding SS not yet received. |
183 | 182 |
184 RTPVideoHeaderVP9* vp9 = &packet->codecSpecificHeader.codecHeader.VP9; | 183 RTPVideoHeaderVP9* vp9 = &packet->codecSpecificHeader.codecHeader.VP9; |
185 vp9->temporal_idx = it->second.temporal_idx[gof_idx]; | 184 vp9->temporal_idx = it->second.temporal_idx[gof_idx]; |
186 vp9->temporal_up_switch = it->second.temporal_up_switch[gof_idx]; | 185 vp9->temporal_up_switch = it->second.temporal_up_switch[gof_idx]; |
187 | 186 |
188 // TODO(asapersson): Set vp9.ref_picture_id[i] and add usage. | 187 // TODO(asapersson): Set vp9.ref_picture_id[i] and add usage. |
189 vp9->num_ref_pics = it->second.num_ref_pics[gof_idx]; | 188 vp9->num_ref_pics = it->second.num_ref_pics[gof_idx]; |
190 for (uint8_t i = 0; i < it->second.num_ref_pics[gof_idx]; ++i) { | 189 for (size_t i = 0; i < it->second.num_ref_pics[gof_idx]; ++i) { |
191 vp9->pid_diff[i] = it->second.pid_diff[gof_idx][i]; | 190 vp9->pid_diff[i] = it->second.pid_diff[gof_idx][i]; |
192 } | 191 } |
193 return true; | 192 return true; |
194 } | 193 } |
195 | 194 |
196 void Vp9SsMap::UpdateFrames(FrameList* frames) { | 195 void Vp9SsMap::UpdateFrames(FrameList* frames) { |
197 for (const auto& frame_it : *frames) { | 196 for (const auto& frame_it : *frames) { |
198 uint8_t gof_idx = | 197 uint8_t gof_idx = |
199 frame_it.second->CodecSpecific()->codecSpecific.VP9.gof_idx; | 198 frame_it.second->CodecSpecific()->codecSpecific.VP9.gof_idx; |
200 if (gof_idx == kNoGofIdx) { | 199 if (gof_idx == kNoGofIdx) { |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 } | 1330 } |
1332 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in | 1331 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in |
1333 // that case we don't wait for retransmissions. | 1332 // that case we don't wait for retransmissions. |
1334 if (high_rtt_nack_threshold_ms_ >= 0 && | 1333 if (high_rtt_nack_threshold_ms_ >= 0 && |
1335 rtt_ms_ >= high_rtt_nack_threshold_ms_) { | 1334 rtt_ms_ >= high_rtt_nack_threshold_ms_) { |
1336 return false; | 1335 return false; |
1337 } | 1336 } |
1338 return true; | 1337 return true; |
1339 } | 1338 } |
1340 } // namespace webrtc | 1339 } // namespace webrtc |
OLD | NEW |